Compare commits

...

794 Commits

Author SHA1 Message Date
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
779 changed files with 167220 additions and 70008 deletions

28
.gitignore vendored
View File

@@ -1,5 +1,6 @@
*~
*.a
*.annot
*.bak
*.class
*.cma
@@ -58,6 +59,7 @@ Makefile.in
/builder/index-parse.h
/builder/index-scan.c
/builder/libguestfs.conf
/builder/link.sh
/builder/*.qcow2
/builder/stamp-virt-builder.pod
/builder/stamp-virt-index-validate.pod
@@ -93,6 +95,7 @@ Makefile.in
/customize/customize_cmdline.mli
/customize/customize-options.pod
/customize/customize-synopsis.pod
/customize/link.sh
/customize/stamp-virt-customize.pod
/customize/virt-customize
/customize/virt-customize.1
@@ -184,6 +187,7 @@ 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
@@ -219,7 +223,6 @@ Makefile.in
/html/guestfs-java.3.html
/html/guestfs-lua.3.html
/html/guestfs-ocaml.3.html
/html/guestfs-p2v-iso.1.html
/html/guestfs-performance.1.html
/html/guestfs-perl.3.html
/html/guestfs-python.3.html
@@ -252,6 +255,8 @@ Makefile.in
/html/virt-ls.1.html
/html/virt-make-fs.1.html
/html/virt-p2v.1.html
/html/virt-p2v-make-disk.1.html
/html/virt-p2v-make-kickstart.1.html
/html/virt-rescue.1.html
/html/virt-resize.1.html
/html/virt-sparsify.1.html
@@ -304,12 +309,14 @@ Makefile.in
/mllib/config.ml
/mllib/dummy
/mllib/libdir.ml
/mllib/link.sh
/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
@@ -321,16 +328,16 @@ Makefile.in
/ocaml/stamp-mlguestfs
/ocaml/t/*.bc
/ocaml/t/*.opt
/p2v/launch-virt-p2v
/p2v/stamp-virt-p2v.pod
/p2v/stamp-virt-p2v-make-disk.pod
/p2v/stamp-virt-p2v-make-kickstart.pod
/p2v/virt-p2v
/p2v/virt-p2v.1
/p2v-iso/guestfs-p2v-iso.1
/p2v-iso/guestfs-p2v-iso.txt
/p2v-iso/kickstart-target.sh
/p2v-iso/launch-virt-p2v
/p2v-iso/p2v.ks
/p2v-iso/stamp-guestfs-p2v-iso.pod
/p2v-iso/virt-builder-target.sh
/p2v/virt-p2v-make-disk
/p2v/virt-p2v-make-disk.1
/p2v/virt-p2v-make-kickstart
/p2v/virt-p2v-make-kickstart.1
/perl/bindtests.pl
/perl/blib
/perl/examples/guestfs-perl.3
@@ -412,6 +419,7 @@ Makefile.in
/rescue/virt-rescue
/rescue/virt-rescue.1
/resize/.depend
/resize/link.sh
/resize/stamp-virt-resize.pod
/resize/virt-resize
/resize/virt-resize.1
@@ -463,6 +471,7 @@ Makefile.in
/stamp-guestfs-release-notes.pod
/stamp-h1
/sysprep/.depend
/sysprep/link.sh
/sysprep/stamp-script1.sh
/sysprep/stamp-script2.sh
/sysprep/stamp-script4.sh
@@ -480,6 +489,7 @@ Makefile.in
/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
@@ -524,6 +534,7 @@ Makefile.in
/tests/guests/guest-aux/windows-system
/tests/guests/stamp-fedora-md.img
/tests/guests/ubuntu.img
/tests/guests/archlinux.img
/tests/guests/windows.img
/tests/mount-local/test-parallel-mount-local
/tests/mountable/test-internal-parse-mountable
@@ -553,5 +564,6 @@ Makefile.in
/v2v/rhel-6.5.img
/v2v/rhel-7.0.img
/v2v/stamp-virt-v2v.pod
/v2v/test-v2v-networks-and-bridges.xml
/v2v/virt-v2v
/v2v/virt-v2v.1

Submodule .gnulib updated: e2646b0c6b...322e0b052c

View File

@@ -10,13 +10,16 @@ Daniel Berrange
Daniel Cabrera
Daniel Exner
Dave Vasilevsky
David Sommerseth
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
@@ -24,6 +27,7 @@ Jiri Popelka
John Eckersberg
Joseph Wang
Karel Klíč
Kashyap Chamarthy
Lee Yarwood
Marcin Gibula
Maros Zatko
@@ -31,7 +35,9 @@ Martin Kletzander
Masami HIRATA
Matthew Booth
Maxim Koltsov
Menanteau Guy
Michael Scherer
Mike Frysinger
Mike Kelly
Nicholas Strugnell
Nikita A Menkovich
@@ -46,6 +52,7 @@ Qin Guan
Rajesh Ranjan
Richard W.M. Jones
Sandeep Shedmake
Shahar Havivi
Shankar Prasad
Thomas S Hatch
Török Edwin

679
BUGS
View File

@@ -1,5 +1,5 @@
NOTE: This file is automatically generated from "update-bugs.sh".
Last updated: 2014-08-13
Last updated: 2015-01-19
This contains a local list of the bugs that are open against
libguestfs. Bugs are tracked in the Red Hat Bugzilla database
@@ -23,9 +23,6 @@ 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.
@@ -101,6 +98,9 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
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
857763 NEW https://bugzilla.redhat.com/show_bug.cgi?id=857763
libguestfs 'file-architecture' returns 'ARM' for arm binaries
@@ -131,6 +131,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
@@ -143,18 +146,21 @@ 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
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
927447 NEW https://bugzilla.redhat.com/show_bug.cgi?id=927447
[suse] virt tools hang on disk image, but libguestfs-test-tool runs OK
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
@@ -191,9 +197,6 @@ 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
@@ -203,18 +206,30 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
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
1056045 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1056045
virt-v2v OVA import fails when no (optional) manifest file is included
1056047 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1056047
virt-df generates no output for Solaris 11 x86_64 guest.
1056126 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1056126
virt-v2v OVA/OVF import fails with 'MegaBytes' as memory allocation units
1056534 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1056534
virt-v2v OVF/OVA import fails when disks aren't attached to either IDE or SCSI controllers
1056640 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1056640
virt-v2v OVA/OVF import fails when no (optional) ovf:capacityAllocationUnits is specified
1056983 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1056983
virt-v2v OVA/OVF import fails when no (optional) ovf:populatedSize is specified
1057006 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1057006
virt-v2v OVA/OVF import fails when no (optional) Name under VirtualSystem is specified
1057873 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1057873
libguestfs df/ subdirectory tests fail occasionally
@@ -230,18 +245,9 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1064041 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1064041
virt-sparsify fails if a btrfs filesystem contains readonly snapshots
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
1079625 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1079625
virt-sparsify fails if a btrfs filesystem contains readonly snapshots
@@ -254,21 +260,12 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1089100 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1089100
NetworkManager avc unlink denied for resolv.conf after using --selinux-relabel
1091856 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1091856
scrub-file can't handle link file
1091859 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1091859
scrub-file can't handle link file
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
1099284 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1099284
typo errors in man pages
1099292 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1099292
sfdisk failed by "Device or resource busy" when using one command line
@@ -276,7 +273,7 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
sfdisk: BLKRRPART: Device or resource busy
1099976 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1099976
virt-builder gives GPG warning message
virt-builder gives GPG warning message with gnupg2
1100138 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1100138
some operation cause "lvremove" can not find the object
@@ -284,15 +281,6 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1100140 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1100140
some operation cause "lvremove" can not find the object
1100528 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1100528
These APIs also need to add to `guestfish -h` command list
1100530 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1100530
These APIs also need to add to `guestfish -h` command list
1100533 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1100533
Remove 'user-cancel' from guestfish(1)
1102241 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1102241
[RFE] libguestfs should detect OSTree (project-atomic) qcow2 disk image
@@ -302,6 +290,9 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
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)
@@ -311,15 +302,9 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1109144 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1109144
virt-builder --get-kernel doesn't fetch the dtb from images
1111662 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1111662
Guestfs.Error("vgchange_uuid_all: Volume group has active logical volumes")
1111794 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1111794
virt-sparsify leaves lots of data in TMPDIR
1113020 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1113020
Support virt-sparsify option to allow specifying temporary file or block device
1113153 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1113153
RFE: Inspection should support systemd mount units
@@ -329,21 +314,210 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1118305 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1118305
RFE: Ability to set iSCSI-Initiator-IQN for iSCSI connections
1123221 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1123221
make xfs faield, "mkfs.xfs: No such file or directory"
1123281 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1123281
lvm-set-filter stopped working in Rawhide
1123797 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1123797
libguestfs 'direct' backend should close file descriptors before exec-ing qemu to avoid leaking !O_CLOEXEC fds
1128942 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1128942
libguests tools failing on images containing a colon in the path
1129110 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1129110
Libguestfs NTFS not setting ACLs
1130506 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1130506
RFE: virt-sparsify in copying mode should support qemu detect-zeroes
1132652 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1132652
virt-sysprep firstboot doesn't work with RHEL 7 guest
1134726 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1134726
[RFE] virt-builder should support args with the --run command
1135064 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1135064
virt-sparsify fails at /sys/block/sdb/dev discovery
1135585 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1135585
[RFE] virt-builder should support copying in a directory/list of files
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
1141451 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1141451
Failures in tests: /dev/sda1: No such file or directory
1142184 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1142184
virt-sparsify --help print description of a option which is hard to get common understanding
1144137 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1144137
virt-inspector fails on Minix 3 guest
1144138 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1144138
virt-inspector fails on FreeBSD 9.3 guest
1145583 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1145583
xen kernel should be removed from boot menu after conversion by virt-v2v
1146007 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1146007
Input/output error during conversion of esx guest.
1146339 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1146339
Improve the error showing when no enough space left on host while conversion
1146477 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1146477
virt-v2v sometimes hangs with printing: Add. Sense: No additional sense information
1146832 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1146832
virt-v2v fail to convert guest with disk type volume
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]
1150816 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1150816
Can not find "RECURSIVE LONG LISTING" in 'man virt-diff'
1150858 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1150858
virt-sparsify: unknown option `--check-tmpdir=ignore'
1151902 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1151902
virt-v2v:Network interface disappear after conversion of guest with interface type direct
1151903 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1151903
virt tools --csv output should have a meaningful output
1151905 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1151905
virt tools --csv output should have a meaningful output
1152369 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1152369
[RFE]virt-v2v failed to convert guest with UEFI firmware
1152533 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1152533
virt-v2v fail to convert guest with virtio lun disk
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
1159030 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1159030
libvirt backend does not set RBD password
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
1164708 NEW 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
1164729 NEW 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
1164765 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1164765
[RFE] Add a new API to scan devices for a btrfs filesystem
1164766 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1164766
[RFE] Add a new API to scan devices for a btrfs filesystem
1166057 NEW 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 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1167623
Remove "If reporting bugs, run virt-v2v with debugging enabled .." message when running virt-p2v
1167916 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1167916
P2V error:unexpected end of file waiting for password prompt.
1167921 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1167921
p2v: No Network Connection dialog
1167922 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1167922
p2v: No virtual console
1168144 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1168144
warning: fstrim: fstrim: /sysroot/: FITRIM ioctl failed: Operation not supported (ignored) when convert win2003 guest from xen server
1168626 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1168626
Tracker: Build RHEL 7.1 - based virt-p2v ISO
1168865 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1168865
warning: /files/boot/grub/device.map/hd0 references unknown device "vda" when convert a local guest with virtio disk to openstack server (-i disk))
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
1172659 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1172659
virt-resize --expand fails on ubuntu-14.04.img image (regression)
1172660 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1172660
virt-resize --expand fails on ubuntu-14.04.img image
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
1173695 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1173695
Error occurred when install a rhel guest with disk pool
1174073 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1174073
The listen address for vnc is changed after conversion by virt-v2v
1174200 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1174200
New virt-v2v failure: CURL: Error opening file: NSS: client certificate not found (nickname not specified): Invalid argument
1174551 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1174551
"lstatnslist" and "lstatlist" don't give an error if the API is used wrongly
1176493 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1176493
virt-v2v ignores sound device when convert xen guest to local kvm
1176526 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1176526
virt-resize cannot shrink ext filesystem by a small amount
1176801 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1176801
File /etc/sysconfig/kernel isn't updated when convert XenPV guest with regular kernel installed
1177460 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1177460
virt-customize does not work with fedora 21 atomic
1177910 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1177910
Libguestfs fails to locate the qemu-kvm on POWER8(BE) host.
1179576 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1179576
virt-v2v prints warning: /files/etc/fstab/8/spec references unknown device "hdb"
1180170 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1180170
virt-builder gives GPG warning message with gnupg2
1180769 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1180769
Security context on image file gets reset
1183234 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1183234
part_get_mbr_id test fails: sfdisk --change-id: sfdisk: change-id is deprecated in favour of ---part-type
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
503134 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=503134
guestfish's list splitting does not recognize internal quoting
@@ -353,6 +527,9 @@ 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
619334 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=619334
RFE: Enable coredump capture in the appliance
@@ -362,7 +539,19 @@ Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
1069966 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1069966
RFE: let virt-builder etc build ARM guests on x86 host
(114 bugs)
1143887 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1143887
Warning shows when converting guests to rhev:chown: changing ownership of ?/tmp/v2v.u48xag/*.ovf?: Invalid argument
1145908 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1145908
No virtio drivers available warning shows when converting win8 guest
1156298 ASSIGNED 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
1176591 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1176591
virt-v2v -o vdsm doesn't work with multiple data domains
(177 bugs)
--------------------------------------------------
Bugs in MODIFIED, POST or ON_QA state are fixed.
@@ -371,17 +560,17 @@ 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)
1073917 POST https://bugzilla.redhat.com/show_bug.cgi?id=1073917
java bindings inspect_list_applications2 throws java.lang.ArrayIndexOutOfBoundsException:
1175196 POST https://bugzilla.redhat.com/show_bug.cgi?id=1175196
"parse-environment" and "parse-environment-list" fail to parse "LIBGUESTFS_TRACE = 0"
1091803 POST https://bugzilla.redhat.com/show_bug.cgi?id=1091803
tar-in-opts execute failed that cause libguestfs appliance crashed
1175676 POST https://bugzilla.redhat.com/show_bug.cgi?id=1175676
Typo error in 'help ping-daemon'
1122557 POST https://bugzilla.redhat.com/show_bug.cgi?id=1122557
virt-sparsify overwrites block devices if used as output files
1176598 POST https://bugzilla.redhat.com/show_bug.cgi?id=1176598
virt-v2v -o vdsm write ovf to specify domain
805417 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=805417
RFE: support inspection of installation ISOs of WinVista, Win7, Win2008 & Win2008r2
1182463 POST https://bugzilla.redhat.com/show_bug.cgi?id=1182463
"mknod-b", "mknod-c", and "mkfifo" do not strip non-permissions bits from "mode"
1053847 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1053847
Recommended default clock/timer settings
@@ -392,56 +581,344 @@ You can help by testing the fixes.
1021149 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1021149
Rebase libguestfs to 1.28 in RHEL 7.1
1079182 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1079182
virt-df cannot report used disk space of windows guest when updated to 6.5
1076213 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1076213
OpenStack as a v2v target.
1097359 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1097359
virt-sparsify hangs with 'No space left on device' while filling LV
1100530 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1100530
These APIs also need to add to `guestfish -h` command list
1106548 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1106548
root gets an error accessing to a non-root dir on a snapshot guestmount VMDK img
1100533 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1100533
Remove 'user-cancel' from guestfish(1)
1117540 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1117540
Support virt-sparsify option to allow specifying temporary file or block device
1122557 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1122557
virt-sparsify overwrites block devices if used as output files
1123794 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1123794
libguestfs 'direct' backend should close file descriptors before exec-ing qemu to avoid leaking !O_CLOEXEC fds
1128942 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1128942
libguests tools failing on images containing a colon in the path
(13 bugs)
1138630 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1138630
Remove user accounts from "/etc/shadow" when exeucte virt-sysprep with '--enable user-account' option
1140946 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1140946
qemu-img shows error message for backing file twice
1153846 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1153846
Redundancy whitespace at the end of directory name when use <TAB> to complete the directory name in guestfish with a xfs filesystem in guest
1160203 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1160203
log of virt-sysprep contains only the output of the last script
1165564 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1165564
Provide Reboot/Shutdown button after virt-p2v
1165569 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1165569
Disable "cancel conversion" button after virt-p2v conversion finished
1167601 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1167601
"Conversion was successful" pop out even virt-p2v fails
1167774 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1167774
virt-p2v fails with error:"nbd.c:nbd_receive_negotiate():L501: read failed"
(21 bugs)
--------------------------------------------------
These bugs are in the VERIFIED state.
624335 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=624335
blockdev-setbsz succeeds, but does not affect blockdev-getbsz
805417 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=805417
RFE: support inspection of installation ISOs of WinVista, Win7, Win2008 & Win2008r2
965495 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=965495
New APIs required in libguestfs for virt-v2v in RHEL 6.5
980790 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=980790
fstrim returns error "FITRIM ioctl failed: Inappropriate ioctl for device"
982979 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=982979
Disable fstrim API/command in RHEL 6
1028676 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1028676
Add virt-builder to RHEL 7.1
1025269 VERIFIED 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
1041552 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1041552
virt-sysprep should remove Pegasus certificates
1056558 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1056558
virt-sparsify overwrites block devices if used as output files
1042780 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1042780
Support the virt-sysprep --delete option
1057510 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1057510
mount-local should give a clearer error if root is not mounted
1073917 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1073917
java bindings inspect_list_applications2 throws java.lang.ArrayIndexOutOfBoundsException:
1072062 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1072062
Ruby bindings for libguestfs throws an error periodically
1074005 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1074005
java bindings inspect_list_applications2 throws java.lang.ArrayIndexOutOfBoundsException:
1091805 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1091805
1091803 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1091803
tar-in-opts execute failed that cause libguestfs appliance crashed
1099105 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1099105
libguestfs Requires: /lib64/libldif-2.4.so.2 missing from openldap-2.4.39-6.el6.x86_64
1091856 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1091856
scrub-file can't handle link file
1099332 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1099332
1091859 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1091859
scrub-file can't handle link file
1099284 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1099284
typo errors in man pages
(10 bugs)
1100528 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1100528
These APIs also need to add to `guestfish -h` command list
1113020 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1113020
Support virt-sparsify option to allow specifying temporary file or block device
1123797 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1123797
libguestfs 'direct' backend should close file descriptors before exec-ing qemu to avoid leaking !O_CLOEXEC fds
1136739 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1136739
virt-v2v warning info should be printed to fill the whole line
1138182 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1138182
xen guest will be kernel panic after converted by virt-v2v
1138184 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1138184
virt-v2v will fail when converting guests with initramfs-*kdump.img under /boot
1138504 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1138504
Support conversion of guests from remote kvm/xen/esx connections by virt-v2v
1138586 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1138586
No error shows when converting running guest with virt-v2v
1138634 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1138634
Remove user accounts from "/etc/shadow" when exeucte virt-sysprep with '--enable user-account' option
1139543 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1139543
Improve the error info when converting guest with no space left
1139973 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1139973
Improve the error info when converting xen guest with no passwordless SSH access configured
1140050 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1140050
No error shows when multiple conflicting options used with virt-v2v
1140547 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1140547
virt-builder option '--format' don't work well
1140894 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1140894
No error messages output if append '--format qcow2' after '-a guest.img', guest.img is a raw format image file
1141113 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1141113
virt-v2v fails to convert esx guests
1141145 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1141145
virt-v2v fails to convert xen pv guests.
1141157 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1141157
virt-sysprep option '--user-accounts' don't work well
1141626 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1141626
virt-sysprep option '--password' don't work well, it will cause login problem and if execute with other options it will take no effect
1141631 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1141631
[RFE] virt-v2 should support convert a guest to a dir-pool with using pool's uuid
1141654 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1141654
virt-v2v: error: access: No such file or directory shows when converting xen/esx guests
1141680 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1141680
[RFE] virt-v2 should support convert a domain with using domain's UUID instead of domain name
1141723 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1141723
virt-v2v: error: disk sda has no defined format shows when converting xen hvm guest
1142004 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1142004
virt-v2v prints warning:WARNING:/files/boot/grub/device.map references unknown device "xvda"
1142008 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1142008
Conversion guest cannot been seen on rhevm server
1142158 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1142158
Illegal command 'part-get-name /dev/sda1 1' cause libguestfs appliance crashed
1142178 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1142178
virt-customize: No error messages output if append '--format qcow2' after '-a guest.img', guest.img is a raw format image file
1142186 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1142186
virt-sysprep option '--mount-options' don't work well
1142416 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1142416
part-get-name give 'libguestfs: error: part_get_name: parted does not support the machine output (-m)' error message when run 'part-get-name /dev/sda 1'
1143866 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1143866
virt-v2v fails with error: cannot open Packages index using db5
1143883 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1143883
warning shows when converting rhel7 guest:virt-v2v:could not update grub2 console: aug_get: no matching node (ignored)
1143949 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1143949
virt-customize option '--password-crypto' do not work
1144197 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1144197
Disable libguestfs UML backend mode in RHEL7
1144201 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1144201
guestfish can not restore terminal's output colour when exit guestfish, if the terminal's background colour is black then it will make a inconvenient
1144766 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1144766
futimens() is a no-op via guestmount
1144927 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1144927
Syntax error in lens definition: /usr/share/guestfs/guestfs_lvm_conf.aug:28.25-.40:Could not load module Quote for Quote.do_dquotee
1145582 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1145582
Failed to import sparse qcow2 disk image after converting to rhevm
1145916 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1145916
virt-v2v fails to convert win7 guest
1145995 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1145995
Improve the error info when converting windows guest with unclean file system
1146017 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1146017
virt-v2v -v -x during windows guest conversion will hang at hivex: hivex_open: used block id ??
1146815 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1146815
virt-v2v prints warning: /files/etc/fstab/8/spec references unknown device "cdrom"
1147065 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1147065
regression setting root password with virt-builder/virt-customize
1147313 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1147313
virt-v2v cmd with option --qemu-boot doesn't work: "qemu-system-x86_64: command not found"
1149640 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1149640
hardcoded el7 disttag in BR makes build fail on ppc64le
1150475 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1150475
Exporting 2+ disk guest to RHEV, only one disk shows after import
1150701 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1150701
virt-v2v does not fstrim data disks and non-mounted filesystems
1150815 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1150815
Can not find "RECURSIVE LONG LISTING" in 'man virt-diff'
1150867 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1150867
'copy-file-to-file /src /dest' create file /dest even if command 'copy-file-to-file /src /dest' failed
1150880 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1150880
virt-v2v: warning: display <graphics type='sdl'> was ignored when converting rhel5 guest with sdl graphics
1151033 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1151033
virt-v2v conversions from VMware vCenter server run slowly
1151725 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1151725
virt-v2v: warning: /files/boot/grub/device.map/hd0 references unknown device "sda" when convert a guest with ide bus
1151738 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1151738
typo error in man page of virt-edit
1151739 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1151739
typo error in man page of virt-edit
1151766 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1151766
libguestfs-bash-completion package contains file /usr/share/bash-completion/completions/virt-log, but no _virt_log() function in that file
1151900 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1151900
Should also add a field for directory files when run virt-ls with --csv option
1151901 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1151901
Should also add a field for directory files when run virt-ls with --csv option
1151910 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1151910
virt-ls should remove '/' in the output when specify the directory name as /etc/
1151911 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1151911
virt-ls should remove '/' in the output when specify the directory name as /etc/
1152998 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1152998
virt-v2v / qemu-img fails on ova image
1153515 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1153515
empty (but set) LIBGUESTFS_BACKEND prints libguestfs: error: invalid backend:
1153589 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1153589
virt-v2v will hang when converting esx guest before disk copy phase
1153730 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1153730
Booting windows 2008 R2 if=virtio gets BSOD
1153844 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1153844
Redundancy whitespace at the end of directory name when use <TAB> to complete the directory name in guestfish with a xfs filesystem in guest
1153974 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1153974
guestfish prints 'n' in error message
1155121 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1155121
Virt-v2v will fail when using relative path for -i ova
1155610 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1155610
disable uninstallation of VMware drivers on Linux for RHEL 7.1
1156301 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1156301
virt-inspector support adding a remote disk, but in its man page -a URI / --add URI is missing
1157691 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1157691
virt-p2v-make-disk should add firmwares
1158526 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1158526
Use password file instead of process interaction
1159258 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1159258
esx win2008 32 bit guest fail to load after conversion because the firmware isn't ACPI compatible
1159651 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1159651
virt-sysprep firstboot script is not deleted if it reboot a RHEL 7 guest
1160043 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1160043
virt-sysprep firstboot script is not deleted if it reboot a RHEL 7 guest
1160199 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1160199
log of virt-sysprep contains only the output of the last script
1161575 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1161575
Failed to import guest with "rtl8139" nic to openstack server after converted by v2v
1162966 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1162966
xfs should also give a warning out to let customer know the limitation
1164619 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1164619
Inspect-get-icon failed on RHEL7 guest
1164697 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1164697
typo errors in man pages
1164732 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1164732
The description of 'help append' is not accurately, it add the kernel options to libguestfs appliance not the guest kernel
1164734 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1164734
The description of 'help append' is not accurately, it add the kernel options to libguestfs appliance not the guest kernel
1164853 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1164853
Booting in qemu found no volume groups and failed checking the filesystems
1165975 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1165975
File "/boot/grub2/device.map" showing is not right after converting a rhel7 guest from esx server
1166618 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1166618
virt-resize should give out the detail warning info to let customers know what's going wrong
1167302 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1167302
virt-v2v: warning: ova hard disk has no parent controller when convert from a ova file
1168632 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1168632
Fix kickstart for virt-p2v
1168751 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1168751
broken lvm-set-filter API with newer lvm2
1170073 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1170073
virt-v2v picks debug kernels over non-debug kernels when versions are equal
1171130 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1171130
virt-v2v conversion of RHEL 3 guest fails with: All of your loopback devices are in use
1174123 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1174123
Graphics password disappear after conversion of virt-v2v
(98 bugs)
End of BUGS file.

View File

@@ -1,5 +1,5 @@
# libguestfs
# Copyright (C) 2009-2014 Red Hat Inc.
# Copyright (C) 2009-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
@@ -82,7 +82,7 @@ SUBDIRS += fish
# virt-tools in C.
SUBDIRS += align cat diff df edit format inspector make-fs rescue
if HAVE_P2V
SUBDIRS += p2v p2v-iso
SUBDIRS += p2v
endif
# bash-completion
@@ -276,9 +276,6 @@ endif
if HAVE_PYTHON
HTMLFILES += html/guestfs-python.3.html
endif
if HAVE_P2V
HTMLFILES += html/guestfs-p2v-iso.1.html
endif
if HAVE_RUBY
HTMLFILES += html/guestfs-ruby.3.html
endif
@@ -287,6 +284,12 @@ HTMLFILES += \
html/guestmount.1.html \
html/guestunmount.1.html
endif
if HAVE_P2V
HTMLFILES += \
html/virt-p2v.1.html \
html/virt-p2v-make-disk.1.html \
html/virt-p2v-make-kickstart.1.html
endif
HTMLSUPPORTFILES = \
html/draft.png \
@@ -424,9 +427,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

18
README
View File

@@ -52,7 +52,8 @@ The full requirements are described below.
+--------------+-------------+---+-----------------------------------------+
| qemu | 1.2.0 | R | 1.1 may work, but has broken virtio-scsi|
+--------------+-------------+---+-----------------------------------------+
| qemu-img | | R | |
| qemu-img | | R | >= 2.2.0 is required for virt-v2v but |
| | | | optional elsewhere |
+--------------+-------------+---+-----------------------------------------+
| kernel | 2.6.34 | R | Make sure the following are enabled |
| | | | compiled in or as a module: |
@@ -85,6 +86,10 @@ The full requirements are described below.
| | | | Optional if compiling from tarball. |
| | | | To build generated files and OCaml bindings.
+--------------+-------------+---+-----------------------------------------+
| findlib | |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. |
@@ -147,7 +152,7 @@ The full requirements are described below.
+--------------+-------------+---+-----------------------------------------+
| sd-journal | | O | systemd journal library |
+--------------+-------------+---+-----------------------------------------+
| yajl | 2 | O | JSON parser for parsing output of |
| yajl | 2.0.4 | O | JSON parser for parsing output of |
| | | | ldmtool and qemu-img info commands. |
+--------------+-------------+---+-----------------------------------------+
| gdisk | | O | GPT disk support. |
@@ -178,11 +183,11 @@ The full requirements are described below.
+--------------+-------------+---+-----------------------------------------+
| gtk2 | | O | Used by virt-p2v user interface. |
+--------------+-------------+---+-----------------------------------------+
| zip, unzip | | O | Used by virt-v2v for OVA files. |
+--------------+-------------+---+-----------------------------------------+
| python-evtx | | O | Used by virt-log to parse Windows |
| | | | Event Log files. |
+--------------+-------------+---+-----------------------------------------+
| findlib | | O | For the OCaml bindings. |
+--------------+-------------+---+-----------------------------------------+
| ocaml-gettext| | O | For localizing OCaml virt-* tools. |
+--------------+-------------+---+-----------------------------------------+
| Python | 2.2 | O | For the Python bindings. |
@@ -220,6 +225,9 @@ The full requirements are described below.
+--------------+-------------+---+-----------------------------------------+
| Sys::Virt | | O | Perl bindings for libvirt. |
+--------------+-------------+---+-----------------------------------------+
| libvirt-python | O | For testing Python libvirt/libguestfs |
| | | | interactions. |
+--------------+-------------+---+-----------------------------------------+
| Win::Hivex | | O | Perl bindings for hivex. |
+--------------+-------------+---+-----------------------------------------+
| Pod::Usage | | O | Perl module used by tests. |
@@ -395,7 +403,7 @@ Don't enable GCC warnings (ie. *don't* use
Copyright and license information
----------------------------------------------------------------------
Copyright (C) 2009-2014 Red Hat Inc.
Copyright (C) 2009-2015 Red Hat Inc.
The library is distributed under the LGPLv2+. The programs are
distributed under the GPLv2+. Please see the files COPYING and

6
TODO
View File

@@ -598,3 +598,9 @@ Improvements in virt-log
- 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

@@ -68,6 +68,7 @@ virt_alignment_scan_LDADD = \
$(top_builddir)/src/libguestfs.la \
$(LIBXML2_LIBS) \
$(LIBVIRT_LIBS) \
$(LTLIBINTL) \
../gnulib/lib/libgnu.la \
-lm

View File

@@ -115,6 +115,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 +123,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,11 +144,10 @@ 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 {
@@ -211,6 +212,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
@@ -350,15 +353,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

@@ -26,7 +26,7 @@ fi
guestsdir="$(cd ../tests/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 ../tests/guests/fedora.img
r=$?
# 0, 2 and 3 are reasonable non-error exit codes. Others are errors.

View File

@@ -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

View File

@@ -1,5 +1,5 @@
# libguestfs
# Copyright (C) 2009-2014 Red Hat Inc.
# Copyright (C) 2009-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
@@ -21,6 +21,8 @@ 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 \
@@ -74,12 +76,14 @@ 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 guestfsd.suppressions 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 $@

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.
@@ -42,3 +45,10 @@ dnl For Debian:
-/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

@@ -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

@@ -41,6 +41,15 @@ ln -s ../run/lock /var/lock
# 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 \
@@ -51,7 +60,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
@@ -59,13 +68,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
@@ -79,12 +81,13 @@ hwclock -u -s
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 grep -sq guestfs_network=1 /proc/cmdline; then
if dhclient --version >/dev/null 2>&1; then
dhclient
else
dhcpcd
fi
fi
# Scan for MDs.
mdadm -As --auto=yes --run
@@ -113,8 +116,7 @@ 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

View File

@@ -175,4 +175,4 @@ Richard W.M. Jones (C<rjones at redhat dot com>)
=head1 COPYRIGHT
Copyright (C) 2009-2014 Red Hat Inc.
Copyright (C) 2009-2015 Red Hat Inc.

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# @configure_input@
# Copyright (C) 2009-2014 Red Hat Inc.
# Copyright (C) 2009-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

View File

@@ -7,8 +7,10 @@ dnl
dnl REDHAT=1 For Fedora, RHEL, EPEL and workalikes.
dnl DEBIAN=1 For Debian.
dnl UBUNTU=1 For Ubuntu.
dnl MAGEIA=1 For Mageia
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
@@ -25,7 +27,7 @@ ifelse(REDHAT,1,
btrfs-progs
cryptsetup
cryptsetup-luks dnl old name used before Fedora 17
e2fsprogs
dhclient
dnl e4fsprogs only exists on RHEL 5, will be ignored everywhere else.
e4fsprogs
genisoimage
@@ -58,7 +60,6 @@ ifelse(DEBIAN,1,
bsdmainutils
btrfs-tools
cryptsetup
e2fsprogs
extlinux
genisoimage
dnl gfs-tools, gfs2-tools have been renamed to gfs2-utils
@@ -73,10 +74,13 @@ dnl iproute has been renamed to iproute2
iputils-ping
iputils-arping
iputils-tracepath
isc-dhcp-client
libaugeas0
libc-bin
libcap2
libhivex0
libpcre3
libsystemd0
libsystemd-id128-0
libsystemd-journal0
libyajl2
@@ -88,6 +92,7 @@ dnl iproute has been renamed to iproute2
openssh-client
reiserfsprogs
sysvinit dnl for /sbin/reboot
systemd dnl alternative for /sbin/reboot
ufsutils
vim-tiny
xz-utils
@@ -99,7 +104,8 @@ ifelse(ARCHLINUX,1,
btrfs-progs
cdrkit
cryptsetup
e2fsprogs
dhcpcd
gptfdisk
grub
hivex
iproute2
@@ -107,6 +113,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
@@ -119,12 +128,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
@@ -136,45 +168,13 @@ 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,
@@ -182,8 +182,9 @@ ifelse(MAGEIA,1,
btrfs-progs
cryptsetup
chkconfig /* for /etc/init.d */
e2fsprogs
cdrkit-genisoimage
cdrkit-isotools
dhcp-client
extlinux
gfs2-utils
grub
@@ -192,6 +193,8 @@ ifelse(MAGEIA,1,
iproute2
iputils
libcap
dnl syslinux uses mtools without depending on it
mtools
nilfs-utils
ntfsprogs
ntfs-3g
@@ -203,10 +206,6 @@ ifelse(MAGEIA,1,
vim-minimal
xz
yajl
module-init-tools
procps-ng
udev
util-linux-ng
)
acl
@@ -218,6 +217,7 @@ coreutils
cpio
diffutils
dosfstools
e2fsprogs
file
findutils
gawk

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 \
@@ -30,45 +35,42 @@ scripts = \
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-log:
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-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
@@ -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-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
@@ -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-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
@@ -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-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
@@ -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-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
@@ -19,15 +19,37 @@
_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 ;;
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 +58,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-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

View File

@@ -1,5 +1,5 @@
# libguestfs virt-builder tool
# Copyright (C) 2013 Red Hat Inc.
# Copyright (C) 2013-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
@@ -18,16 +18,9 @@
include $(top_srcdir)/subdir-rules.mk
AM_YFLAGS = -d
AM_CFLAGS = \
-I$(shell $(OCAMLC) -where) \
-I$(top_srcdir)/gnulib/lib \
-I$(top_srcdir)/src \
-I$(top_srcdir)/fish \
-pthread \
$(LIBLZMA_CFLAGS)
EXTRA_DIST = \
$(SOURCES) \
$(SOURCES_MLI) $(SOURCES_ML) $(SOURCES_C) \
libguestfs.gpg \
test-index \
test-virt-builder.sh \
@@ -40,105 +33,107 @@ EXTRA_DIST = \
virt-builder.pod \
virt-index-validate.pod
CLEANFILES = *~ *.cmi *.cmo *.cmx *.cmxa *.o virt-builder
CLEANFILES = *~ *.annot *.cmi *.cmo *.cmx *.cmxa *.o virt-builder
# Alphabetical order.
SOURCES = \
architecture.ml \
builder.ml \
SOURCES_MLI = \
cache.mli \
cache.ml \
cmdline.ml \
downloader.mli \
downloader.ml \
get_kernel.mli \
get_kernel.ml \
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 \
sources.mli \
sources.ml \
uname.mli
SOURCES_ML = \
utils.ml \
pxzcat.ml \
setlocale.ml \
uname.ml \
uname.mli \
architecture.ml \
ini_reader.ml \
paths.ml \
languages.ml \
get_kernel.ml \
cache.ml \
sources.ml \
downloader.ml \
sigchecker.ml \
index_parser.ml \
list_entries.ml \
cmdline.ml \
builder.ml
SOURCES_C = \
$(top_srcdir)/mllib/fsync-c.c \
$(top_srcdir)/mllib/uri-c.c \
$(top_srcdir)/mllib/mkdtemp-c.c \
$(top_srcdir)/customize/perl_edit-c.c \
$(top_srcdir)/customize/crypt-c.c \
$(top_srcdir)/fish/uri.c \
$(top_srcdir)/fish/file-edit.c \
index-scan.c \
index-struct.c \
index-parse.c \
index-parser-c.c \
pxzcat-c.c \
setlocale-c.c \
uname-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/regedit.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 \
cache.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)
bin_SCRIPTS = virt-builder
BOBJECTS = \
$(top_builddir)/mllib/libdir.cmo \
$(top_builddir)/mllib/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/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
@@ -146,6 +141,7 @@ 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
@@ -153,38 +149,32 @@ if HAVE_OCAML_PKG_GETTEXT
OCAMLPACKAGES += -package gettext-stub
endif
OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX-3 $(OCAMLPACKAGES)
OCAMLOPTFLAGS = $(OCAMLCFLAGS)
OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR)
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)' \
-o $@
if !HAVE_OCAMLOPT
OBJECTS = $(BOBJECTS)
BEST = c
OCAMLLINKFLAGS = mlguestfs.cma -custom
else
virt-builder: $(OBJECTS)
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) \
mlguestfs.cma -linkpkg $^ \
-cclib '$(OCAMLCLIBS)' \
-custom \
-o $@
OBJECTS = $(XOBJECTS)
BEST = opt
OCAMLLINKFLAGS = mlguestfs.cmxa
endif
virt_builder_DEPENDENCIES = $(OBJECTS)
virt_builder_LINK = \
./link.sh \
$(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.
@@ -224,12 +214,12 @@ fedora.qcow2: ../tests/guests/fedora.img
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
rm -f $@ $@-t
xz --best --block-size=16777216 -c $< > $@-t
xz --best -c $< > $@-t
mv $@-t $@
TESTS = \
@@ -275,7 +265,7 @@ install-exec-hook:
$(LN_S) 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 \
@@ -285,9 +275,16 @@ 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
@@ -310,12 +307,13 @@ CLEANFILES += \
stamp-virt-index-validate.pod
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.h
endif
# Apparently there's no clean way with Automake to not have them

View File

@@ -23,6 +23,7 @@ module G = Guestfs
open Common_utils
open Password
open Planner
open Utils
open Cmdline
open Customize_cmdline
@@ -30,8 +31,6 @@ open Customize_cmdline
open Unix
open Printf
let quote = Filename.quote
let prog = Filename.basename Sys.executable_name
let () = Random.self_init ()
@@ -85,12 +84,12 @@ let main () =
(* If debugging, echo the command line arguments and the sources. *)
if verbose then (
eprintf "command line:";
List.iter (eprintf " %s") (Array.to_list Sys.argv);
prerr_newline ();
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
printf "source[%d] = (%S, %S)\n" i source fingerprint
) sources
);
@@ -108,9 +107,7 @@ let main () =
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
@@ -122,27 +119,21 @@ let main () =
*)
let cmd = sprintf "%s --help >/dev/null 2>&1" 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
)
if 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 ~prog (f_"gpg program is not available")
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
);
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. *)
let cache =
@@ -151,34 +142,31 @@ let main () =
| Some dir ->
try Some (Cache.create ~verbose ~directory:dir)
with exn ->
warning ~prog (f_"cache %s: %s") dir (Printexc.to_string exn);
warning ~prog (f_"disabling the cache");
warning (f_"cache %s: %s") dir (Printexc.to_string exn);
warning (f_"disabling the cache");
None
in
(* Download the sources. *)
let downloader = Downloader.create ~verbose ~curl ~cache in
let repos = Sources.read_sources ~prog ~verbose in
let repos = List.map (
fun { Sources.uri = uri; Sources.gpgkey = gpgkey; Sources.proxy = proxy } ->
let gpgkey =
match gpgkey with
| None -> Sigchecker.No_Key
| Some key -> Sigchecker.KeyFile key in
uri, gpgkey, proxy
) repos in
let sources = List.map (
fun (source, fingerprint) ->
source, Sigchecker.Fingerprint fingerprint, Downloader.SystemProxy
{
Sources.name = source; uri = source;
gpgkey = Utils.Fingerprint fingerprint;
proxy = Downloader.SystemProxy;
}
) sources in
let sources = List.append repos sources in
let index : Index_parser.index =
List.concat (
List.map (
fun (source, key, proxy) ->
fun source ->
let sigchecker =
Sigchecker.create ~verbose ~gpg ~check_signature ~gpgkey:key in
Index_parser.get_index ~prog ~verbose ~downloader ~sigchecker ~proxy source
Sigchecker.create ~verbose ~gpg ~check_signature
~gpgkey:source.Sources.gpgkey in
Index_parser.get_index ~prog ~verbose ~downloader ~sigchecker source
) sources
) in
let index = remove_duplicates index in
@@ -209,8 +197,7 @@ 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,
@@ -246,9 +233,8 @@ let main () =
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
error (f_"cannot find os-version '%s' with architecture '%s'.\nUse --list to list available guest types.")
arg arch in
let entry = snd item in
let sigchecker = entry.Index_parser.sigchecker in
@@ -315,8 +301,10 @@ let main () =
| 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
@@ -330,10 +318,8 @@ let main () =
| 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
@@ -357,16 +343,12 @@ let main () =
(* --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 =
@@ -483,45 +465,44 @@ let main () =
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 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
);
@@ -544,14 +525,14 @@ let main () =
let ofile = List.assoc `Filename otags in
msg (f_"Copying");
let cmd = sprintf "cp %s %s" (quote ifile) (quote ofile) in
if verbose 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 verbose then eprintf "%s\n%!" cmd;
if verbose then printf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1
| itags, `Pxzcat, otags ->
@@ -591,7 +572,7 @@ let main () =
| None -> ""
| Some lvexpand -> sprintf " --lv-expand %s" (quote lvexpand))
(quote ifile) (quote ofile) in
if verbose then eprintf "%s\n%!" cmd;
if verbose then printf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1
| itags, `Disk_resize, otags ->
@@ -602,7 +583,7 @@ let main () =
(human_size osize);
let cmd = sprintf "qemu-img resize %s %Ld%s"
(quote ofile) osize (if verbose then "" else " >/dev/null") in
if verbose then eprintf "%s\n%!" cmd;
if verbose then printf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1
| itags, `Convert, otags ->
@@ -619,7 +600,7 @@ let main () =
| Some iformat -> sprintf " -f %s" (quote iformat))
(quote ifile) (quote oformat) (quote ofile)
(if verbose then "" else " >/dev/null 2>&1") in
if verbose then eprintf "%s\n%!" cmd;
if verbose then printf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1
) plan;
@@ -633,7 +614,11 @@ let main () =
(match smp with None -> () | Some smp -> g#set_smp smp);
g#set_network 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;
@@ -659,14 +644,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 ~verbose ~quiet g root ops;
Customize_run.run ~verbose ~quiet g root ops;
(* Collect some stats about the final output file.
* Notes:
@@ -736,30 +721,4 @@ let main () =
| None -> ()
| Some stats -> 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 ~prog main

View File

@@ -1,5 +1,5 @@
(* virt-builder
* Copyright (C) 2013-2014 Red Hat Inc.
* Copyright (C) 2013-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
@@ -19,11 +19,11 @@
open Common_gettext.Gettext
open Common_utils
open Utils
open Unix
open Printf
let quote = Filename.quote
let clean_cachedir dir =
let cmd = sprintf "rm -rf %s" (quote dir) in
ignore (Sys.command cmd);

View File

@@ -1,5 +1,5 @@
(* virt-builder
* Copyright (C) 2013-2014 Red Hat Inc.
* Copyright (C) 2013-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

View File

@@ -23,13 +23,13 @@ open Common_utils
open Customize_cmdline
open Utils
module G = Guestfs
open Unix
open Printf
let prog = Filename.basename Sys.executable_name
let parse_cmdline () =
let display_version () =
printf "virt-builder %s\n" Config.package_version;
@@ -77,8 +77,7 @@ 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
@@ -136,6 +135,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)";
"--short-options", Arg.Unit display_short_options, " " ^ s_"List short options";
"--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";
@@ -158,8 +158,7 @@ let parse_cmdline () =
"--version", Arg.Unit display_version, " " ^ s_"Display version and exit";
"-x", Arg.Set trace, " " ^ s_"Enable tracing of libguestfs calls";
] 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
@@ -236,28 +235,25 @@ 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_"virt-builder --list: use '--list-format', not '--format'");
(match args with
| [] -> ""
| _ ->
eprintf (f_"%s: virt-builder --list does not need any extra arguments.\n") prog;
exit 1
error (f_"virt-builder --list does not need any extra arguments")
)
| `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_"virt-builder: too many parameters, expecting 'os-version'");
)
| `Cache_all
| `Print_cache
@@ -265,18 +261,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_"virt-builder --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_"virt-builder --get-kernel: too many parameters")
) in
(* Check source(s) and fingerprint(s). *)
@@ -296,11 +289,8 @@ read the man page virt-builder(1).
repeat fingerprint nr_sources
| xs -> xs 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
@@ -317,14 +307,11 @@ read the man page virt-builder(1).
| `Command _ | `InstallPackages _ | `Script _ | `Update -> true
| `Delete _ | `Edit _ | `FirstbootCommand _ | `FirstbootPackages _
| `FirstbootScript _ | `Hostname _ | `Link _ | `Mkdir _
| `Password _ | `RootPassword _ | `Scrub _ | `Timezone _ | `Upload _
| `Write _ | `Chmod _ -> false
| `Password _ | `RootPassword _ | `Scrub _ | `SSHInject _
| `Timezone _ | `Upload _ | `Write _ | `Chmod _ -> 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
);
if requires_execute_on_guest then
error (f_"sorry, cannot run commands on a guest with a different architecture");
);
target_arch in
@@ -337,7 +324,7 @@ 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

View File

@@ -19,11 +19,11 @@
open Common_gettext.Gettext
open Common_utils
open Utils
open Unix
open Printf
let quote = Filename.quote
type uri = string
type filename = string
@@ -73,8 +73,8 @@ and download_to ~prog 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 cache if the network
@@ -91,11 +91,8 @@ and download_to ~prog t ?(progress_bar = false) ~proxy uri filename =
(if t.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
)
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. *)
@@ -104,13 +101,10 @@ and download_to ~prog t ?(progress_bar = false) ~proxy uri filename =
t.curl
(if t.verbose then "" else " -s -S")
(quote uri) in
if t.verbose then eprintf "%s\n%!" cmd;
if t.verbose then printf "%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 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
@@ -118,11 +112,8 @@ and download_to ~prog t ?(progress_bar = false) ~proxy 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%s -g -o %s %s"
@@ -130,13 +121,10 @@ and download_to ~prog t ?(progress_bar = false) ~proxy uri filename =
t.curl
(if t.verbose then "" else if progress_bar then " -#" else " -s -S")
(quote filename_new) (quote uri) in
if t.verbose then eprintf "%s\n%!" cmd;
if t.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. *)
@@ -154,7 +142,7 @@ and proxy_envvar protocol = function
(* No changes required. *)
""
| ForcedProxy proxy ->
let proxy = Filename.quote proxy in
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

View File

@@ -19,6 +19,8 @@
open Common_gettext.Gettext
open Common_utils
open Utils
module G = Guestfs
open Printf
@@ -34,14 +36,10 @@ let rec get_kernel ~trace ~verbose ?format ?output 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
);
if Array.length roots = 0 then
error (f_"get-kernel: no operating system found");
if Array.length roots > 1 then
error (f_"get-kernel: dual/multi-boot images are not supported by this tool");
let root = roots.(0) in
(* Mount up the disks. *)
@@ -51,7 +49,7 @@ let rec get_kernel ~trace ~verbose ?format ?output disk =
List.iter (
fun (mp, dev) ->
try g#mount_ro dev mp
with Guestfs.Error msg -> eprintf "%s (ignored)\n" msg
with Guestfs.Error msg -> warning (f_"%s (ignored)") msg
) mps;
(* Get all kernels and initramfses. *)
@@ -69,10 +67,8 @@ let rec get_kernel ~trace ~verbose ?format ?output disk =
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
);
if kernels = [] then
error (f_"no kernel found");
(* Download the latest. *)
let outputdir =

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);
@@ -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>
%%
@@ -153,8 +153,8 @@ yyerror (YYLTYPE * yylloc, yyscan_t scanner, struct parse_context *context, cons
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->program_name ? context->program_name : "",
context->program_name ? ": " : "",
context->progname ? context->progname : "",
context->progname ? ": " : "",
context->input_file ? context->input_file : "",
context->input_file ? ": " : "",
yylloc->first_line, msg,

View File

@@ -45,6 +45,8 @@ 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 error_suffixv, value filenamev)
{
@@ -56,7 +58,7 @@ virt_builder_parse_index (value progv, value error_suffixv, 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);

View File

@@ -16,19 +16,33 @@
* 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"
#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 scanner_init (yyscan_t *scanner, struct parse_context *context, FILE *in);
extern void scanner_destroy (yyscan_t scanner);
%}
%option nounput

View File

@@ -44,7 +44,7 @@ struct parse_context {
*/
int seen_comments;
const char *input_file;
const char *program_name;
const char *progname;
const char *error_suffix;
};

View File

@@ -19,6 +19,8 @@
open Common_gettext.Gettext
open Common_utils
open Utils
open Printf
open Unix
@@ -109,16 +111,15 @@ let print_entry chan (name, { printable_name = printable_name;
);
if hidden then fp "hidden=true\n"
let get_index ~prog ~verbose ~downloader ~sigchecker ~proxy source =
let get_index ~prog ~verbose ~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 ~proxy source in
let tmpfile, delete_tmpfile = Downloader.download ~prog downloader ~proxy uri in
(* Check index file signature (also verifies it was fully
* downloaded and not corrupted in transit).
@@ -145,7 +146,7 @@ let get_index ~prog ~verbose ~downloader ~sigchecker ~proxy 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
@@ -161,9 +162,9 @@ let get_index ~prog ~verbose ~downloader ~sigchecker ~proxy 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
@@ -182,12 +183,12 @@ let get_index ~prog ~verbose ~downloader ~sigchecker ~proxy 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))
@@ -202,8 +203,7 @@ let get_index ~prog ~verbose ~downloader ~sigchecker ~proxy source =
with
| Not_found -> 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
@@ -211,11 +211,10 @@ let get_index ~prog ~verbose ~downloader ~sigchecker ~proxy 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))
@@ -223,8 +222,8 @@ let get_index ~prog ~verbose ~downloader ~sigchecker ~proxy 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
@@ -248,8 +247,8 @@ let get_index ~prog ~verbose ~downloader ~sigchecker ~proxy 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 =
@@ -280,8 +279,8 @@ let get_index ~prog ~verbose ~downloader ~sigchecker ~proxy source =
) sections in
if verbose then (
eprintf "index file (%s) after parsing (C parser):\n" source;
List.iter (print_entry Pervasives.stderr) entries
printf "index file (%s) after parsing (C parser):\n" uri;
List.iter (print_entry Pervasives.stdout) entries
);
entries
@@ -289,25 +288,24 @@ let get_index ~prog ~verbose ~downloader ~sigchecker ~proxy 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;
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

@@ -38,4 +38,4 @@ and entry = {
proxy : Downloader.proxy_mode;
}
val get_index : prog:string -> verbose:bool -> downloader:Downloader.t -> sigchecker:Sigchecker.t -> proxy:Downloader.proxy_mode -> string -> index
val get_index : prog:string -> verbose:bool -> downloader:Downloader.t -> sigchecker:Sigchecker.t -> Sources.source -> index

View File

@@ -1,5 +1,5 @@
(* virt-builder
* Copyright (C) 2013-2014 Red Hat Inc.
* Copyright (C) 2013-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

View File

@@ -1,5 +1,5 @@
(* virt-builder
* Copyright (C) 2013-2014 Red Hat Inc.
* Copyright (C) 2013-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

View File

@@ -1,5 +1,5 @@
(* virt-builder
* Copyright (C) 2013-2014 Red Hat Inc.
* Copyright (C) 2013-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

22
builder/link.sh.in Normal file
View File

@@ -0,0 +1,22 @@
# libguestfs Makefile.am
# @configure_input@
# (C) Copyright 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., 675 Mass Ave, Cambridge, MA 02139, USA.
# Hack automake to link binary properly. There is no other way to add
# the -cclib parameter to the end of the command line.
exec "$@" -linkpkg -cclib '-pthread -lpthread -lutils @LIBTINFO_LIBS@ -lcrypt @LIBLZMA_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'

View File

@@ -47,13 +47,13 @@ and list_entries_long ~sources index =
let langs = Languages.languages () in
List.iter (
fun (source, key, proxy) ->
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"
@@ -97,92 +97,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 json_optional_printf_stringlist key = function
| None -> ()
| Some l ->
printf " \"%s\": [" key;
iteri (
fun i alias ->
printf " \"%s\"%s" alias (trailing_comma i (List.length l))
) l;
printf " ],\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, proxy) ->
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_parser.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;
json_optional_printf_stringlist "aliases" aliases;
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 * Downloader.proxy_mode) list -> Index_parser.index -> unit
val list_entries : list_format:([ `Short | `Long | `Json ]) -> sources:Sources.source list -> Index_parser.index -> unit

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,9 @@
#include <caml/memory.h>
#include <caml/mlvalues.h>
#include "guestfs.h"
#include "guestfs-internal-frontend.h"
#include "ignore-value.h"
#if HAVE_LIBLZMA
@@ -55,6 +59,8 @@ extern void unix_error (int errcode, char * cmdname, value arg) Noreturn;
#define PARALLEL_XZCAT 0
#endif
extern value virt_builder_using_parallel_xzcat (value unitv);
value
virt_builder_using_parallel_xzcat (value unitv)
{
@@ -65,6 +71,8 @@ virt_builder_using_parallel_xzcat (value unitv)
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)
{
@@ -98,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 */
@@ -117,7 +125,7 @@ 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");
@@ -141,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);
@@ -158,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)) {
@@ -181,31 +187,31 @@ 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);
}
/* Tell the kernel we won't read the output file. */
@@ -217,7 +223,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
@@ -256,7 +262,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");
@@ -269,10 +275,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 &&
@@ -304,7 +310,7 @@ 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);
@@ -322,7 +328,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;
@@ -341,10 +347,10 @@ 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) {
@@ -456,7 +462,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;
@@ -472,7 +478,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. */
@@ -491,6 +497,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)
@@ -500,19 +524,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);
@@ -633,8 +667,7 @@ worker_thread (void *vp)
* sparseness. However we have to update oposition.
*/
if (!is_zero (outbuf, wsz)) {
if (pwrite (global->ofd, outbuf, wsz, oposition) != wsz) {
/* XXX Handle short writes. */
if (xpwrite (global->ofd, outbuf, wsz, oposition) == -1) {
perror (global->filename);
return &state->status;
}

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,16 +19,11 @@
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 = {
verbose : bool;
gpg : string;
@@ -44,12 +39,10 @@ let import_keyfile ~gpg ~gpghome ~verbose keyfile =
let cmd = sprintf "%s --homedir %s --status-file %s --import %s%s"
gpg gpghome (quote status_file) (quote keyfile)
(if verbose then "" else " >/dev/null 2>&1") in
if verbose 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: 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.");
status_file
let rec create ~verbose ~gpg ~gpgkey ~check_signature =
@@ -68,12 +61,10 @@ let rec create ~verbose ~gpg ~gpgkey ~check_signature =
*)
let cmd = sprintf "%s --homedir %s --list-keys%s"
gpg tmpdir (if verbose then "" else " >/dev/null 2>&1") in
if verbose 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 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
@@ -96,12 +87,10 @@ let rec create ~verbose ~gpg ~gpgkey ~check_signature =
let cmd = sprintf "%s --yes --armor --output %s --export %s%s"
gpg (quote filename) (quote fp)
(if verbose then "" else " >/dev/null 2>&1") in
if verbose 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: could not export public key\nUse the '-v' option and look for earlier error messages.\n");
exit 1
);
if r <> 0 then
error (f_"could not export public key\nUse the '-v' option and look for earlier error messages.");
ignore (import_keyfile gpg tmpdir verbose filename);
fp
) else
@@ -148,8 +137,7 @@ 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\nyou are susceptible to man-in-the-middle attacks.\n")
| Some sigfile ->
let args = sprintf "%s %s" (quote sigfile) (quote filename) in
do_verify t args
@@ -163,12 +151,10 @@ and do_verify t args =
t.gpg t.gpghome
(if t.verbose then "" else " -q --logger-file /dev/null")
(quote status_file) args in
if t.verbose then eprintf "%s\n%!" cmd;
if t.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
@@ -183,11 +169,9 @@ and do_verify t args =
| _ -> ()
) 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
)
if not (equal_fingerprints !fingerprint t.fingerprint) then
error (f_"fingerprint of signature does not match the expected fingerprint!\n found fingerprint: %s\n expected fingerprint: %s")
!fingerprint t.fingerprint
type csum_t = SHA512 of string
@@ -196,12 +180,10 @@ let verify_checksum t (SHA512 csum) filename =
unlink_on_exit csum_file;
let cmd = sprintf "sha512sum %s | awk '{print $1}' > %s"
(quote filename) (quote csum_file) in
if t.verbose then eprintf "%s\n%!" cmd;
if t.verbose then printf "%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
);
if r <> 0 then
error (f_"could not run sha512sum command to verify checksum");
let csum_actual = read_whole_file csum_file in
@@ -212,8 +194,6 @@ let verify_checksum t (SHA512 csum) filename =
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 csum <> csum_actual then
error (f_"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!")
csum_actual csum

View File

@@ -18,12 +18,7 @@
type t
type gpgkey_type =
| No_Key
| Fingerprint of string
| KeyFile of string
val create : verbose:bool -> gpg:string -> gpgkey:gpgkey_type -> check_signature:bool -> t
val create : verbose:bool -> gpg:string -> gpgkey:Utils.gpgkey_type -> check_signature:bool -> t
val verify : t -> string -> unit
(** Verify the file is signed (if check_signature is true). *)

View File

@@ -25,7 +25,7 @@ open Unix
type source = {
name : string;
uri : string;
gpgkey : string option;
gpgkey : Utils.gpgkey_type;
proxy : Downloader.proxy_mode;
}
@@ -33,7 +33,7 @@ module StringSet = Set.Make (String)
let parse_conf ~prog ~verbose file =
if verbose then (
eprintf (f_"%s: trying to read %s\n") prog file;
printf (f_"%s: trying to read %s\n") prog file;
);
let sections = Ini_reader.read_ini ~prog ~error_suffix:"[ignored]" file in
@@ -52,19 +52,19 @@ let parse_conf ~prog ~verbose file =
| Not_found -> None
| Invalid_argument "URI.parse_uri" as ex ->
if verbose then (
eprintf (f_"%s: '%s' has invalid gpgkey URI\n") prog n;
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 verbose then (
eprintf (f_"%s: '%s' has non-local gpgkey URI\n") prog n;
printf (f_"%s: '%s' has non-local gpgkey URI\n") prog n;
);
None
Utils.No_Key
) in
let proxy =
try
@@ -84,7 +84,7 @@ let parse_conf ~prog ~verbose file =
) sections [] in
if verbose then (
eprintf (f_"%s: ... read %d sources\n") prog (List.length sources);
printf (f_"%s: ... read %d sources\n") prog (List.length sources);
);
sources
@@ -127,12 +127,12 @@ let read_sources ~prog ~verbose =
) with
| Unix_error (code, fname, _) ->
if verbose then (
eprintf (f_"%s: file error: %s: %s\n") prog fname (error_message code)
printf (f_"%s: file error: %s: %s\n") prog fname (error_message code)
);
acc
| Invalid_argument msg ->
if verbose then (
eprintf (f_"%s: internal error: invalid argument: %s\n") prog msg
printf (f_"%s: internal error: invalid argument: %s\n") prog msg
);
acc
) acc files

View File

@@ -19,7 +19,7 @@
type source = {
name : string;
uri : string;
gpgkey : string option;
gpgkey : Utils.gpgkey_type;
proxy : Downloader.proxy_mode;
}

View File

@@ -26,7 +26,7 @@ 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
@@ -40,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
@@ -111,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

@@ -29,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
@@ -43,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

@@ -37,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
@@ -55,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 \
@@ -65,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 \
@@ -73,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.out <<EOF
# Uploaded files
is-file /etc/foo/bar/baz/Makefile
cat /etc/foo/bar/baz/foo

View File

@@ -19,6 +19,6 @@
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-bad-1
$VG virt-index-validate test-virt-index-validate-good-1
$VG virt-index-validate test-virt-index-validate-good-2

View File

@@ -33,6 +33,8 @@
extern void unix_error (int errcode, char * cmdname, value arg) Noreturn;
#endif
extern value virt_builder_uname (value unit);
value
virt_builder_uname (value unit)
{

35
builder/utils.ml Normal file
View File

@@ -0,0 +1,35 @@
(* virt-builder
* Copyright (C) 2013-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.
*)
(* Utilities/common functions used in virt-builder only. *)
open Printf
open Common_utils
type gpgkey_type =
| No_Key
| Fingerprint of string
| KeyFile of string
let prog = Filename.basename Sys.executable_name
let error ?exit_code fs = error ~prog ?exit_code fs
let warning fs = warning ~prog fs
let info fs = info ~prog fs
let quote = Filename.quote

View File

@@ -164,7 +164,9 @@ 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
creation, long before boot).
@@ -307,13 +309,13 @@ alternate home directory:
=item B<--list>
=item B<--list --format> format
=item B<--list --list-format> format
=item B<--list --long>
List available templates.
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
@@ -772,6 +774,37 @@ If C</tmp> or C<C:\Temp> is missing.
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 C<~/.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 C<FILENAME>. C<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 C<~USER/.ssh> directory and the
C<~USER/.ssh/authorized_keys> file will be created if not existing
already.
=head2 INSTALLATION PROCESS
When you invoke virt-builder, installation proceeds as follows:
@@ -843,7 +876,9 @@ 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:
virt-install --os-variant list
osinfo-query os
The above tool is provided by libosinfo package.
=item 3.
@@ -1601,6 +1636,11 @@ 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

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# virt-builder
# Copyright (C) 2013-2014 Red Hat Inc.
# Copyright (C) 2013-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

View File

@@ -30,7 +30,11 @@ if [ $# -ne 1 ]; then
fi
version=$1
tree=http://mirror.bytemark.co.uk/fedora/linux/releases/$version/Fedora/x86_64/os/
if [ $version -lt 21 ]; then
tree=http://mirror.bytemark.co.uk/fedora/linux/releases/$version/Fedora/x86_64/os/
else
tree=http://mirror.bytemark.co.uk/fedora/linux/releases/$version/Server/x86_64/os/
fi
output=fedora-$version
tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)

View File

@@ -1,15 +1,15 @@
[centos-6]
name=CentOS 6.5
osinfo=centos6.5
name=CentOS 6.6
osinfo=centos6.6
arch=x86_64
file=centos-6.xz
revision=5
checksum=8f08505ec708b04a25bbd21816cdda8a5eff8bbf85fec3caff6d7a9a7bfba07dafa707e60772f5676c437a6d3381cd26b4e48bc82a232bc940ca9dcddcff7a85
revision=6
checksum=fc403ea3555a5608a25ad30ce2514b67288311a7197ddf9fb664475820f26db2bd95a86be9cd6e3f772187b384a02e0965430456dd518d343a80457057bc5441
format=raw
size=6442450944
compressed_size=197139324
compressed_size=199265736
expand=/dev/sda3
notes=CentOS 6.5
notes=CentOS 6.6
This CentOS image contains only unmodified @Core group packages.
@@ -191,26 +191,28 @@ notes=Fedora 20.
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[rhel-7rc]
name=Red Hat Enterprise Linux® 7 Release Candidate
[fedora-21]
name=Fedora® 21 Server
osinfo=fedora21
arch=x86_64
file=rhel-7rc.xz
checksum=c4252cfdf7482d4289de24f78e7fd1b9c9b6ff702d717a1c2a54a341b0565c03a5c8e95d32e1f23f7afe5ed2cf5b8e0f0ee3e16c1179e01348a54f82cb552c0f
file=fedora-21.xz
revision=1
checksum=4dc92cbf540d3a0745ffe1fa01ffae15f17e7a8aa45c70ad975a1dda82b7f1ebe42f912be74d91a5866a91ee2ca3be3c2be274b5da29db930fe1ec8c2286575b
format=raw
size=6442450944
compressed_size=210202084
size=4294967296
compressed_size=209059864
expand=/dev/sda3
notes=Red Hat Enterprise Linux® 7 Release Candidate
notes=Fedora 21 Server.
This image contains only unmodified @Core group packages.
This Fedora image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/rhel.sh
builder/website/fedora.sh
Red Hat Enterprise Linux is a trademark of Red Hat, Inc.
Source and further information is available from ftp://ftp.redhat.com
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[scientificlinux-6]
name=Scientific Linux 6.5

View File

@@ -2,17 +2,17 @@
Hash: SHA1
[centos-6]
name=CentOS 6.5
osinfo=centos6.5
name=CentOS 6.6
osinfo=centos6.6
arch=x86_64
file=centos-6.xz
revision=5
checksum=8f08505ec708b04a25bbd21816cdda8a5eff8bbf85fec3caff6d7a9a7bfba07dafa707e60772f5676c437a6d3381cd26b4e48bc82a232bc940ca9dcddcff7a85
revision=6
checksum=fc403ea3555a5608a25ad30ce2514b67288311a7197ddf9fb664475820f26db2bd95a86be9cd6e3f772187b384a02e0965430456dd518d343a80457057bc5441
format=raw
size=6442450944
compressed_size=197139324
compressed_size=199265736
expand=/dev/sda3
notes=CentOS 6.5
notes=CentOS 6.6
This CentOS image contains only unmodified @Core group packages.
@@ -194,26 +194,28 @@ notes=Fedora 20.
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[rhel-7rc]
name=Red Hat Enterprise Linux® 7 Release Candidate
[fedora-21]
name=Fedora® 21 Server
osinfo=fedora21
arch=x86_64
file=rhel-7rc.xz
checksum=c4252cfdf7482d4289de24f78e7fd1b9c9b6ff702d717a1c2a54a341b0565c03a5c8e95d32e1f23f7afe5ed2cf5b8e0f0ee3e16c1179e01348a54f82cb552c0f
file=fedora-21.xz
revision=1
checksum=4dc92cbf540d3a0745ffe1fa01ffae15f17e7a8aa45c70ad975a1dda82b7f1ebe42f912be74d91a5866a91ee2ca3be3c2be274b5da29db930fe1ec8c2286575b
format=raw
size=6442450944
compressed_size=210202084
size=4294967296
compressed_size=209059864
expand=/dev/sda3
notes=Red Hat Enterprise Linux® 7 Release Candidate
notes=Fedora 21 Server.
This image contains only unmodified @Core group packages.
This Fedora image contains only unmodified @Core group packages.
It is thus very minimal. The kickstart and install script can be
found in the libguestfs source tree:
builder/website/rhel.sh
builder/website/fedora.sh
Red Hat Enterprise Linux is a trademark of Red Hat, Inc.
Source and further information is available from ftp://ftp.redhat.com
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Source and further information is available from http://fedoraproject.org/
[scientificlinux-6]
name=Scientific Linux 6.5
@@ -321,17 +323,17 @@ notes=Ubuntu 14.04 (Trusty).
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAEBAgAGBQJTu7WkAAoJEJFzj3Pht2igRNYQAKlLcgtJ9uMMmP70d93fT9dP
o1Ui29qpXYGEyD5hm+39Dy86FrUYGRbXIMZZX1mS4mkPYfD4zcD6sx0anhEkfSBq
wBGAQgMHDO1voFHJHpydmqDd3F60DRBycIZnGr9kDcpdwo/AgFcCGZWYSdBR5uSs
X1oIwZtWRy03rKBDBoCS/XQ68JP3rw9wjQHvOewMijmpVSYcTUQybBhSNsd9Yrdd
sulALoaJTjjWhQv8XDXI6iQSO9Q7+MWz08fLRqFv8tNkAeWSfIPchVtUHF0WvUVR
VnVVJEc/hb+MJoYEFAU84wRsryy9frii8C5d2y89oAJB7nX+axS1smkTDxBcZPEQ
mdAxkoZC1wFlryhgnNIQXDZBwxmIuMHUldExR8FZA8nmSh0SPWGrq9ofpZh0u8N1
oxSoauDrzWHJuhU15gR+1K3uoidVGTXHM+A4us/flJ0qNJ8+kZuxtSgvcXzha39K
uSmgk/APGnumKwr8VB9DaM6eC5VqKFnHKk3PttRS+G2bkdUHakcu5TWd0Fr2ISmW
RJRwQYodd2SLH/bJ3mdR99Uv5ObkzBzq9IIqCD3squPm9Qh6cQUOaJ1bgwMCuvQN
rx0y9K0CYBg6pPfNgEiRmtItqrJUgvgQEQBfQOQmbcXYTX089HNuTBTXLPWBLiRH
HE/+U5EuzjFGZzUasFmn
=bMpw
iQIcBAEBAgAGBQJUh0qYAAoJEJFzj3Pht2igo4gP/jHI52b2SNlKDkIFMjM26ztL
UxtxHlU+70y8pOq/78beVHuiGYFGpkgmbU6lzPpVDivZP4riX1VWUWDWppmu2eEr
SatDQEaUI1dlETFULXA2kpebH0Q4HsuALZeTt8y9j2U8l/JbKmqBM95f4YOxZiaf
/UCfF+Er23Lp0whbPVlKDlWQvEVuGANllhoP0lGzLjaz5AHdjLewC+VcJrax74TO
Lo/aelcZ6M0IYHyXJKUFHl1MrudoWcPvwvTevS7T9zTWJv4Pr+cfCquRxuZ2WZez
hlwDcMYAO8XF7GsIjGl5ay2Y2H0Anm9iIFwR/bfGMr2EnLLxYZ0qYmeZeO9ZCQFK
or57RjBebb4qvl5LQQ6JcagRUBPpQ7V5H0sbKTZgLbTDyuUWy+3xJ1MOIZPlnVvB
gqVgbim9oPatIAgDUS60v4Gu5IFWoi8rgKoPUbY2eSmCfLd8wf1TeC2wQ4vKYJjj
pMnnmR74gOUL5uUSFV+kM9PqdO65T5YJEG0Be09WCWqkvXbDsOpWDnBz4d5rfxbA
78lAILtBcDZJvYk+dEekK2TKcWEBfqOPJ5ecWSoogn8pCdnvx3mMzGDaFzDiiiC+
75nhFNimJs/akwOFh2DLkML0dfIMoaRwTrSoyAfAY+k9rCXBxNVsR0PtThEXaNYo
RnA1DWswrHxjgIEj4pao
=TEYf
-----END PGP SIGNATURE-----

View File

@@ -35,6 +35,26 @@ tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
guestroot=/dev/sda3
case $version in
3.*)
major=3
minor=`echo $version | awk -F. '{print $2}'`
topurl=http://download.devel.redhat.com/released/RHEL-$major/U$minor/AS
tree=$topurl/x86_64/tree
srpms=$topurl/x86_64/tree/SRPMS
bootfs=ext2
rootfs=ext3
guestroot=/dev/sda2
;;
4.*)
major=4
minor=`echo $version | awk -F. '{print $2}'`
topurl=http://download.devel.redhat.com/released/RHEL-$major/U$minor/AS
tree=$topurl/x86_64/tree
srpms=$topurl/x86_64/tree/SRPMS
bootfs=ext2
rootfs=ext3
guestroot=/dev/sda2
;;
5.*)
major=5
minor=`echo $version | awk -F. '{print $2}'`
@@ -82,10 +102,22 @@ keyboard us
network --bootproto dhcp
rootpw builder
firewall --enabled --ssh
selinux --enforcing
timezone --utc America/New_York
EOF
if [ $major -le 4 ]; then
cat >> $ks <<EOF
langsupport en_US
mouse generic
EOF
fi
if [ $major -ge 4 ]; then
cat >> $ks <<EOF
selinux --enforcing
EOF
fi
if [ $major -eq 5 ]; then
cat >> $ks <<EOF
key --skip
@@ -100,9 +132,17 @@ part /boot --fstype=$bootfs --size=512 --asprimary
part swap --size=1024 --asprimary
part / --fstype=$rootfs --size=1024 --grow --asprimary
EOF
if [ $major -ge 4 ]; then
cat >> $ks <<EOF
# Halt the system once configuration has finished.
poweroff
EOF
fi
cat >> $ks <<EOF
%packages
@core
EOF
@@ -173,9 +213,11 @@ virt-install \
--nographics \
--noreboot
if [ $major -ge 5 ]; then
# We have to replace yum config so it doesn't try to use RHN (it
# won't be registered).
guestfish --rw -a $output -m $guestroot \
upload $yum /etc/yum.repos.d/download.devel.redhat.com.repo
fi
source $(dirname "$0")/compress.sh $output

View File

@@ -27,14 +27,14 @@
export LANG=C
set -e
if [ ! -x builder/virt-builder ]; then
if ! virt-builder --help >/dev/null 2>&1 || [ ! -f builder/virt-builder.pod ]; then
echo "$0: running the test from the wrong directory, or libguestfs has not been built"
exit 1
fi
if [ $# -lt 1 ]; then
echo "$0: missing os-version"
echo "try: ./run builder/virt-builder -l"
echo "try: ./run virt-builder -l"
exit 1
fi
@@ -42,7 +42,7 @@ osversion="$1"
shift
output="$osversion.img"
builder/virt-builder "$osversion" \
virt-builder "$osversion" \
--no-cache -v \
--size 10G \
--root-password password:123456 \

View File

@@ -24,8 +24,8 @@ fn=test-filename-for-index-validate
rm -f $fn
touch $fn
$VG ../virt-index-validate $srcdir/index
$VG ../virt-index-validate $srcdir/index.asc
$VG ../virt-index-validate $fn
$VG virt-index-validate $srcdir/index
$VG virt-index-validate $srcdir/index.asc
$VG virt-index-validate $fn
rm $fn

View File

@@ -1,5 +1,5 @@
# libguestfs virt-cat, virt-filesystems, virt-log and virt-ls.
# Copyright (C) 2010-2014 Red Hat Inc.
# Copyright (C) 2010-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
@@ -42,7 +42,9 @@ SHARED_SOURCE_FILES = \
../fish/options.h \
../fish/options.c \
../fish/uri.h \
../fish/uri.c
../fish/uri.c \
../fish/windows.h \
../fish/windows.c
virt_cat_SOURCES = \
$(SHARED_SOURCE_FILES) \
@@ -64,6 +66,7 @@ virt_cat_LDADD = \
$(top_builddir)/src/libguestfs.la \
$(LIBXML2_LIBS) \
$(LIBVIRT_LIBS) \
$(LTLIBINTL) \
../gnulib/lib/libgnu.la
virt_filesystems_SOURCES = \
@@ -86,6 +89,7 @@ virt_filesystems_LDADD = \
$(top_builddir)/src/libguestfs.la \
$(LIBXML2_LIBS) \
$(LIBVIRT_LIBS) \
$(LTLIBINTL) \
../gnulib/lib/libgnu.la
virt_log_SOURCES = \
@@ -108,6 +112,7 @@ virt_log_LDADD = \
$(top_builddir)/src/libguestfs.la \
$(LIBXML2_LIBS) \
$(LIBVIRT_LIBS) \
$(LTLIBINTL) \
../gnulib/lib/libgnu.la
virt_ls_SOURCES = \
@@ -132,6 +137,7 @@ virt_ls_LDADD = \
$(top_builddir)/src/libguestfs.la \
$(LIBXML2_LIBS) \
$(LIBVIRT_LIBS) \
$(LTLIBINTL) \
../gnulib/lib/libgnu.la
# Manual pages and HTML files for the website.

125
cat/cat.c
View File

@@ -29,10 +29,9 @@
#include <assert.h>
#include <libintl.h>
#include "c-ctype.h"
#include "guestfs.h"
#include "options.h"
#include "windows.h"
/* Currently open libguestfs handle. */
guestfs_h *g;
@@ -46,8 +45,6 @@ const char *libvirt_uri = NULL;
int inspector = 1;
static int do_cat (int argc, char *argv[]);
static int is_windows (guestfs_h *g, const char *root);
static char *windows_path (guestfs_h *g, const char *root, const char *filename);
static void __attribute__((noreturn))
usage (int status)
@@ -102,6 +99,7 @@ main (int argc, char *argv[])
{ "keys-from-stdin", 0, 0, 0 },
{ "long-options", 0, 0, 0 },
{ "mount", 1, 0, 'm' },
{ "short-options", 0, 0, 0 },
{ "verbose", 0, 0, 'v' },
{ "version", 0, 0, 'V' },
{ 0, 0, 0, 0 }
@@ -112,6 +110,7 @@ main (int argc, char *argv[])
struct mp *mp;
char *p;
const char *format = NULL;
bool format_consumed = true;
int c;
int r;
int option_index;
@@ -130,15 +129,14 @@ 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, "keys-from-stdin")) {
keys_from_stdin = 1;
} else if (STREQ (long_options[option_index].name, "echo-keys")) {
echo_keys = 1;
} else if (STREQ (long_options[option_index].name, "format")) {
if (!optarg || STREQ (optarg, ""))
format = NULL;
else
format = optarg;
OPTION_format;
} else {
fprintf (stderr, _("%s: unknown long option: %s (%d)\n"),
program_name, long_options[option_index].name, option_index);
@@ -232,6 +230,8 @@ main (int argc, char *argv[])
if (optind >= argc || argc - optind < 1)
usage (EXIT_FAILURE);
CHECK_OPTION_format_consumed;
/* User must have specified some drives. */
if (drvs == NULL)
usage (EXIT_FAILURE);
@@ -285,7 +285,8 @@ do_cat (int argc, char *argv[])
const char *filename = argv[i];
if (windows) {
filename = filename_to_free = windows_path (g, root, filename);
filename = filename_to_free = windows_path (g, root, filename,
1 /* readonly */);
if (filename == NULL) {
errors++;
continue;
@@ -298,109 +299,3 @@ do_cat (int argc, char *argv[])
return errors == 0 ? 0 : -1;
}
static int
is_windows (guestfs_h *g, const char *root)
{
char *type;
int w;
type = guestfs_inspect_get_type (g, root);
if (!type)
return 0;
w = STREQ (type, "windows");
free (type);
return w;
}
static void mount_drive_letter_ro (char drive_letter, const char *root);
static char *
windows_path (guestfs_h *g, const char *root, const char *path)
{
char *ret;
size_t i;
/* If there is a drive letter, rewrite the path. */
if (c_isalpha (path[0]) && path[1] == ':') {
char drive_letter = c_tolower (path[0]);
/* This returns the newly allocated string. */
mount_drive_letter_ro (drive_letter, root);
ret = strdup (path + 2);
if (ret == NULL) {
perror ("strdup");
exit (EXIT_FAILURE);
}
}
else if (!*path) {
ret = strdup ("/");
if (ret == NULL) {
perror ("strdup");
exit (EXIT_FAILURE);
}
}
else {
ret = strdup (path);
if (ret == NULL) {
perror ("strdup");
exit (EXIT_FAILURE);
}
}
/* Blindly convert any backslashes into forward slashes. Is this good? */
for (i = 0; i < strlen (ret); ++i)
if (ret[i] == '\\')
ret[i] = '/';
/* If this fails, we want to return NULL. */
char *t = guestfs_case_sensitive_path (g, ret);
free (ret);
ret = t;
return ret;
}
static void
mount_drive_letter_ro (char drive_letter, const char *root)
{
char **drives;
char *device;
size_t i;
/* Resolve the drive letter using the drive mappings table. */
drives = guestfs_inspect_get_drive_mappings (g, root);
if (drives == NULL || drives[0] == NULL) {
fprintf (stderr, _("%s: to use Windows drive letters, this must be a Windows guest\n"),
program_name);
exit (EXIT_FAILURE);
}
device = NULL;
for (i = 0; drives[i] != NULL; i += 2) {
if (c_tolower (drives[i][0]) == drive_letter && drives[i][1] == '\0') {
device = drives[i+1];
break;
}
}
if (device == NULL) {
fprintf (stderr, _("%s: drive '%c:' not found.\n"),
program_name, drive_letter);
exit (EXIT_FAILURE);
}
/* Unmount current disk and remount device. */
if (guestfs_umount_all (g) == -1)
exit (EXIT_FAILURE);
if (guestfs_mount_ro (g, device, "/") == -1)
exit (EXIT_FAILURE);
for (i = 0; drives[i] != NULL; ++i)
free (drives[i]);
free (drives);
/* Don't need to free (device) because that string was in the
* drives array.
*/
}

View File

@@ -164,6 +164,7 @@ main (int argc, char *argv[])
{ "physical-volumes", 0, 0, 0 },
{ "physvols", 0, 0, 0 },
{ "pvs", 0, 0, 0 },
{ "short-options", 0, 0, 0 },
{ "uuid", 0, 0, 0 },
{ "uuids", 0, 0, 0 },
{ "verbose", 0, 0, 'v' },
@@ -175,6 +176,7 @@ main (int argc, char *argv[])
};
struct drv *drvs = NULL;
const char *format = NULL;
bool format_consumed = true;
int c;
int option_index;
int no_title = 0; /* --no-title */
@@ -196,15 +198,14 @@ 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, "keys-from-stdin")) {
keys_from_stdin = 1;
} else if (STREQ (long_options[option_index].name, "echo-keys")) {
echo_keys = 1;
} 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, "all")) {
output = OUTPUT_ALL;
} else if (STREQ (long_options[option_index].name, "blkdevs") ||
@@ -296,6 +297,8 @@ main (int argc, char *argv[])
if (optind != argc)
usage (EXIT_FAILURE);
CHECK_OPTION_format_consumed;
/* -h and --csv doesn't make sense. Spreadsheets will corrupt these
* fields. (RHBZ#600977).
*/

View File

@@ -1,5 +1,5 @@
/* virt-log
* Copyright (C) 2010-2014 Red Hat Inc.
* Copyright (C) 2010-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
@@ -34,8 +34,6 @@
#include <sys/types.h>
#include <sys/wait.h>
#include "c-ctype.h"
#include "guestfs.h"
#include "options.h"
@@ -66,7 +64,7 @@ usage (int status)
else {
fprintf (stdout,
_("%s: display log files in a virtual machine\n"
"Copyright (C) 2010-2014 Red Hat Inc.\n"
"Copyright (C) 2010-2015 Red Hat Inc.\n"
"Usage:\n"
" %s [--options] -d domname\n"
" %s [--options] -a disk.img [-a disk.img ...]\n"
@@ -107,12 +105,14 @@ main (int argc, char *argv[])
{ "help", 0, 0, HELP_OPTION },
{ "keys-from-stdin", 0, 0, 0 },
{ "long-options", 0, 0, 0 },
{ "short-options", 0, 0, 0 },
{ "verbose", 0, 0, 'v' },
{ "version", 0, 0, 'V' },
{ 0, 0, 0, 0 }
};
struct drv *drvs = NULL;
const char *format = NULL;
bool format_consumed = true;
int c;
int r;
int option_index;
@@ -131,15 +131,14 @@ 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, "keys-from-stdin")) {
keys_from_stdin = 1;
} else if (STREQ (long_options[option_index].name, "echo-keys")) {
echo_keys = 1;
} else if (STREQ (long_options[option_index].name, "format")) {
if (!optarg || STREQ (optarg, ""))
format = NULL;
else
format = optarg;
OPTION_format;
} else {
fprintf (stderr, _("%s: unknown long option: %s (%d)\n"),
program_name, long_options[option_index].name, option_index);
@@ -191,6 +190,8 @@ main (int argc, char *argv[])
if (optind != argc)
usage (EXIT_FAILURE);
CHECK_OPTION_format_consumed;
/* User must have specified some drives. */
if (drvs == NULL)
usage (EXIT_FAILURE);

View File

@@ -71,7 +71,7 @@ static void output_int64 (int64_t);
static void output_int64_dev (int64_t);
static void output_int64_perms (int64_t);
static void output_int64_size (int64_t);
static void output_int64_time (int64_t);
static void output_int64_time (int64_t secs, int64_t nsecs);
static void output_int64_uid (int64_t);
static void output_string (const char *);
static void output_string_link (const char *);
@@ -151,6 +151,7 @@ main (int argc, char *argv[])
{ "long-options", 0, 0, 0 },
{ "mount", 1, 0, 'm' },
{ "recursive", 0, 0, 'R' },
{ "short-options", 0, 0, 0 },
{ "time", 0, 0, 0 },
{ "times", 0, 0, 0 },
{ "time-days", 0, 0, 0 },
@@ -168,6 +169,7 @@ main (int argc, char *argv[])
struct mp *mp;
char *p;
const char *format = NULL;
bool format_consumed = true;
int c;
int option_index;
#define MODE_LS_L 1
@@ -189,15 +191,14 @@ 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, "keys-from-stdin")) {
keys_from_stdin = 1;
} else if (STREQ (long_options[option_index].name, "echo-keys")) {
echo_keys = 1;
} 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, "checksum") ||
STREQ (long_options[option_index].name, "checksums")) {
if (!optarg || STREQ (optarg, ""))
@@ -327,6 +328,8 @@ main (int argc, char *argv[])
assert (inspector == 1 || mps != NULL);
assert (live == 0);
CHECK_OPTION_format_consumed;
/* Many flags only apply to -lR mode. */
if (mode != MODE_LS_LR &&
(csv || human || enable_uids || enable_times || enable_extra_stats ||
@@ -449,7 +452,7 @@ do_ls_R (const char *dir)
return 0;
}
static int show_file (const char *dir, const char *name, const struct guestfs_stat *stat, const struct guestfs_xattr_list *xattrs, void *unused);
static int show_file (const char *dir, const char *name, const struct guestfs_statns *stat, const struct guestfs_xattr_list *xattrs, void *unused);
static int
do_ls_lR (const char *dir)
@@ -466,7 +469,7 @@ do_ls_lR (const char *dir)
*/
static int
show_file (const char *dir, const char *name,
const struct guestfs_stat *stat,
const struct guestfs_statns *stat,
const struct guestfs_xattr_list *xattrs,
void *unused)
{
@@ -476,45 +479,45 @@ show_file (const char *dir, const char *name,
/* Display the basic fields. */
output_start_line ();
if (is_reg (stat->mode))
if (is_reg (stat->st_mode))
filetype = "-";
else if (is_dir (stat->mode))
else if (is_dir (stat->st_mode))
filetype = "d";
else if (is_chr (stat->mode))
else if (is_chr (stat->st_mode))
filetype = "c";
else if (is_blk (stat->mode))
else if (is_blk (stat->st_mode))
filetype = "b";
else if (is_fifo (stat->mode))
else if (is_fifo (stat->st_mode))
filetype = "p";
else if (is_lnk (stat->mode))
else if (is_lnk (stat->st_mode))
filetype = "l";
else if (is_sock (stat->mode))
else if (is_sock (stat->st_mode))
filetype = "s";
else
filetype = "u";
output_string (filetype);
output_int64_perms (stat->mode & 07777);
output_int64_perms (stat->st_mode & 07777);
output_int64_size (stat->size);
output_int64_size (stat->st_size);
/* Display extra fields when enabled. */
if (enable_uids) {
output_int64_uid (stat->uid);
output_int64_uid (stat->gid);
output_int64_uid (stat->st_uid);
output_int64_uid (stat->st_gid);
}
if (enable_times) {
output_int64_time (stat->atime);
output_int64_time (stat->mtime);
output_int64_time (stat->ctime);
output_int64_time (stat->st_atime_sec, stat->st_atime_nsec);
output_int64_time (stat->st_mtime_sec, stat->st_mtime_nsec);
output_int64_time (stat->st_ctime_sec, stat->st_ctime_nsec);
}
if (enable_extra_stats) {
output_int64_dev (stat->dev);
output_int64 (stat->ino);
output_int64 (stat->nlink);
output_int64_dev (stat->rdev);
output_int64 (stat->blocks);
output_int64_dev (stat->st_dev);
output_int64 (stat->st_ino);
output_int64 (stat->st_nlink);
output_int64_dev (stat->st_rdev);
output_int64 (stat->st_blocks);
}
/* Disabled for now -- user would definitely want these to be interpreted.
@@ -524,17 +527,20 @@ show_file (const char *dir, const char *name,
path = full_path (dir, name);
if (checksum && is_reg (stat->mode)) {
csum = guestfs_checksum (g, checksum, path);
if (!csum)
exit (EXIT_FAILURE);
if (checksum) {
if (is_reg (stat->st_mode)) {
csum = guestfs_checksum (g, checksum, path);
if (!csum)
exit (EXIT_FAILURE);
output_string (csum);
output_string (csum);
} else if (csv)
output_string ("");
}
output_string (path);
if (is_lnk (stat->mode))
if (is_lnk (stat->st_mode))
/* XXX Fix this for NTFS. */
link = guestfs_readlink (g, path);
if (link)
@@ -703,7 +709,7 @@ output_int64_perms (int64_t i)
}
static void
output_int64_time (int64_t i)
output_int64_time (int64_t secs, int64_t nsecs)
{
int r;
@@ -713,19 +719,19 @@ output_int64_time (int64_t i)
if (time_t_output) {
switch (time_relative) {
case 0: /* --time-t */
r = printf ("%10" PRIi64, i);
r = printf ("%10" PRIi64, secs);
break;
case 1: /* --time-relative */
r = printf ("%8" PRIi64, now - i);
r = printf ("%8" PRIi64, now - secs);
break;
case 2: /* --time-days */
default:
r = printf ("%3" PRIi64, (now - i) / 86400);
r = printf ("%3" PRIi64, (now - secs) / 86400);
break;
}
}
else {
time_t t = (time_t) i;
time_t t = (time_t) secs;
char buf[64];
struct tm *tm;

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# libguestfs
# Copyright (C) 2009-2014 Red Hat Inc.
# Copyright (C) 2009-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
@@ -20,11 +20,11 @@ export LANG=C
set -e
# Read out the test files from the image using virt-cat.
if [ "$($VG ./virt-cat ../tests/guests/fedora.img /etc/test1)" != "abcdefg" ]; then
if [ "$($VG virt-cat ../tests/guests/fedora.img /etc/test1)" != "abcdefg" ]; then
echo "$0: error: mismatch in file test1"
exit 1
fi
if [ "$($VG ./virt-cat ../tests/guests/fedora.img /etc/test2)" != "" ]; then
if [ "$($VG virt-cat ../tests/guests/fedora.img /etc/test2)" != "" ]; then
echo "$0: error: mismatch in file test2"
exit 1
fi

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# libguestfs
# Copyright (C) 2009-2014 Red Hat Inc.
# Copyright (C) 2009-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
@@ -19,7 +19,7 @@
export LANG=C
set -e
output="$($VG ./virt-filesystems -a ../tests/guests/fedora.img | sort)"
output="$($VG virt-filesystems -a ../tests/guests/fedora.img | sort)"
expected="/dev/VG/LV1
/dev/VG/LV2
/dev/VG/LV3
@@ -32,7 +32,7 @@ if [ "$output" != "$expected" ]; then
exit 1
fi
output="$($VG ./virt-filesystems -a ../tests/guests/fedora.img --all --long --uuid -h --no-title | awk '{print $1}' | sort -u)"
output="$($VG virt-filesystems -a ../tests/guests/fedora.img --all --long --uuid -h --no-title | awk '{print $1}' | sort -u)"
expected="/dev/VG
/dev/VG/LV1
/dev/VG/LV2

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# libguestfs
# Copyright (C) 2009-2014 Red Hat Inc.
# Copyright (C) 2009-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
@@ -19,7 +19,37 @@
export LANG=C
set -e
can_handle ()
{
fn=$(basename $1)
case "$fn" in
fedora.img)
guestfish -a /dev/null run : available journal
;;
*)
return 0
;;
esac
}
tmpfile=`mktemp`
# Read out the log files from the image using virt-log.
for f in ../tests/guests/{fedora,debian,ubuntu}.img; do
if [ -s "$f" ]; then $VG ./virt-log -a "$f"; fi
echo "Trying $f ..."
if [ ! -s "$f" ]; then
echo "SKIP: empty file"
echo
continue
fi
if ! can_handle "$f"; then
echo "SKIP: cannot handle $f"
echo
continue
fi
$VG virt-log -a "$f" &> $tmpfile
cat $tmpfile
echo
done
rm -f $tmpfile

View File

@@ -20,7 +20,7 @@ export LANG=C
set -e
# Read out the test directory using virt-ls.
if [ "$($VG ./virt-ls ../tests/guests/fedora.img /bin)" != "ls
if [ "$($VG virt-ls ../tests/guests/fedora.img /bin)" != "ls
test1
test2
test3
@@ -33,7 +33,7 @@ test7" ]; then
fi
# Try the -lR option.
output="$($VG ./virt-ls -lR ../tests/guests/fedora.img /boot | awk '{print $1 $2 $4}')"
output="$($VG virt-ls -lR ../tests/guests/fedora.img /boot | awk '{print $1 $2 $4}')"
expected="d0755/boot
d0755/boot/grub
-0644/boot/grub/grub.conf
@@ -49,5 +49,5 @@ if [ "$output" != "$expected" ]; then
fi
# Try the -l and -R options. XXX Should check the output.
$VG ./virt-ls -l ../tests/guests/fedora.img /
$VG ./virt-ls -R ../tests/guests/fedora.img /
$VG virt-ls -l ../tests/guests/fedora.img /
$VG virt-ls -R ../tests/guests/fedora.img /

View File

@@ -148,4 +148,4 @@ Richard W.M. Jones L<http://people.redhat.com/~rjones/>
=head1 COPYRIGHT
Copyright (C) 2010-2014 Red Hat Inc.
Copyright (C) 2010-2015 Red Hat Inc.

View File

@@ -531,4 +531,4 @@ Richard W.M. Jones L<http://people.redhat.com/~rjones/>
=head1 COPYRIGHT
Copyright (C) 2009-2014 Red Hat Inc.
Copyright (C) 2009-2015 Red Hat Inc.

View File

@@ -1,5 +1,5 @@
/* virt-ls visitor function
* Copyright (C) 2010-2014 Red Hat Inc.
* Copyright (C) 2010-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
@@ -51,11 +51,11 @@ _visit (guestfs_h *g, int depth, const char *dir,
* case.
*/
if (depth == 0) {
CLEANUP_FREE_STAT struct guestfs_stat *stat = NULL;
CLEANUP_FREE_STATNS struct guestfs_statns *stat = NULL;
CLEANUP_FREE_XATTR_LIST struct guestfs_xattr_list *xattrs = NULL;
int r;
stat = guestfs_lstat (g, dir);
stat = guestfs_lstatns (g, dir);
if (stat == NULL)
return -1;
@@ -71,14 +71,14 @@ _visit (guestfs_h *g, int depth, const char *dir,
size_t i, xattrp;
CLEANUP_FREE_STRING_LIST char **names = NULL;
CLEANUP_FREE_STAT_LIST struct guestfs_stat_list *stats = NULL;
CLEANUP_FREE_STAT_LIST struct guestfs_statns_list *stats = NULL;
CLEANUP_FREE_XATTR_LIST struct guestfs_xattr_list *xattrs = NULL;
names = guestfs_ls (g, dir);
if (names == NULL)
return -1;
stats = guestfs_lstatlist (g, dir, names);
stats = guestfs_lstatnslist (g, dir, names);
if (stats == NULL)
return -1;
@@ -123,7 +123,7 @@ _visit (guestfs_h *g, int depth, const char *dir,
return -1;
/* Recursively call visit, but only on directories. */
if (is_dir (stats->val[i].mode)) {
if (is_dir (stats->val[i].st_mode)) {
path = full_path (dir, names[i]);
if (_visit (g, depth + 1, path, f, opaque) == -1)
return -1;
@@ -138,13 +138,18 @@ full_path (const char *dir, const char *name)
{
int r;
char *path;
int len;
len = strlen (dir);
if (len > 0 && dir[len - 1] == '/')
--len;
if (STREQ (dir, "/"))
r = asprintf (&path, "/%s", name ? name : "");
else if (name)
r = asprintf (&path, "%s/%s", dir, name);
r = asprintf (&path, "%.*s/%s", len, dir, name);
else
r = asprintf (&path, "%s", dir);
r = asprintf (&path, "%.*s", len, dir);
if (r == -1) {
perror ("asprintf");

View File

@@ -1,5 +1,5 @@
/* virt-ls visitor function
* Copyright (C) 2010-2014 Red Hat Inc.
* Copyright (C) 2010-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
@@ -19,7 +19,7 @@
#ifndef VISIT_H
#define VISIT_H
typedef int (*visitor_function) (const char *dir, const char *name, const struct guestfs_stat *stat, const struct guestfs_xattr_list *xattrs, void *opaque);
typedef int (*visitor_function) (const char *dir, const char *name, const struct guestfs_statns *stat, const struct guestfs_xattr_list *xattrs, void *opaque);
extern int visit (guestfs_h *g, const char *dir, visitor_function f, void *opaque);

View File

@@ -1,5 +1,5 @@
# libguestfs
# Copyright (C) 2009-2014 Red Hat Inc.
# Copyright (C) 2009-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
@@ -25,8 +25,8 @@
# add extra information using --with-extra="..." which may be any
# freeform string.
m4_define([libguestfs_major], [1])
m4_define([libguestfs_minor], [27])
m4_define([libguestfs_release], [26])
m4_define([libguestfs_minor], [29])
m4_define([libguestfs_release], [21])
AC_INIT([libguestfs],libguestfs_major.libguestfs_minor.libguestfs_release)
AC_CONFIG_AUX_DIR([build-aux])
@@ -203,6 +203,14 @@ test "x$U" != "x" && AC_MSG_ERROR([Compiler not ANSI compliant])
AM_PROG_CC_C_O
# Provide a global place to set CFLAGS. (Note that setting AM_CFLAGS
# is no use because it doesn't override target_CFLAGS).
#---
# Kill -fstrict-overflow which is a license for the C compiler to make
# dubious and often unsafe optimizations, in a time-wasting attempt to
# deal with CPU architectures that do not exist.
CFLAGS="$CFLAGS -fno-strict-overflow -Wno-strict-overflow"
dnl Work out how to specify the linker script to the linker.
VERSION_SCRIPT_FLAGS=-Wl,--version-script=
`/usr/bin/ld --help 2>&1 | grep -- --version-script >/dev/null` || \
@@ -270,6 +278,12 @@ dnl Check if stat has the required fields.
AC_STRUCT_ST_BLOCKS
AC_CHECK_MEMBER([struct stat.st_blksize],[
AC_DEFINE([HAVE_STRUCT_STAT_ST_BLKSIZE],[1],[Define to 1 if 'st_blksize' is a member of 'struct stat'.])])
AC_CHECK_MEMBER([struct stat.st_atim.tv_nsec],[
AC_DEFINE([HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC],[1],[Define to 1 if 'st_mtim.tv_nsec' is a member of 'struct stat'.])])
AC_CHECK_MEMBER([struct stat.st_mtim.tv_nsec],[
AC_DEFINE([HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC],[1],[Define to 1 if 'st_mtim.tv_nsec' is a member of 'struct stat'.])])
AC_CHECK_MEMBER([struct stat.st_ctim.tv_nsec],[
AC_DEFINE([HAVE_STRUCT_STAT_ST_CTIM_TV_NSEC],[1],[Define to 1 if 'st_mtim.tv_nsec' is a member of 'struct stat'.])])
dnl Define a C symbol for the host CPU architecture.
AC_DEFINE_UNQUOTED([host_cpu],["$host_cpu"],[Host architecture.])
@@ -282,6 +296,7 @@ AC_CHECK_HEADERS([\
attr/xattr.h \
byteswap.h \
endian.h \
sys/endian.h \
errno.h \
linux/fs.h \
linux/raid/md_u.h \
@@ -321,19 +336,37 @@ AC_CHECK_FUNCS([\
statvfs \
sync])
dnl tgetent, tputs and UP [sic] are all required. They come from libtinfo
dnl which is pulled in as a dependency of libncurses.
old_LIBS="$LIBS"
AC_CHECK_LIB([ncurses], [tgetent], [], [
AC_MSG_ERROR(['ncurses' library not found, or it doesn't contain 'tgetent'])
dnl Check for UNIX_PATH_MAX, creating a custom one if not available.
AC_MSG_CHECKING([for UNIX_PATH_MAX])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#include <sys/un.h>
]], [[
#ifndef UNIX_PATH_MAX
#error UNIX_PATH_MAX not defined
#endif
]])], [
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
AC_MSG_CHECKING([for size of sockaddr_un.sun_path])
AC_COMPUTE_INT(unix_path_max, [sizeof (myaddr.sun_path)], [
#include <sys/un.h>
struct sockaddr_un myaddr;
], [
AC_MSG_ERROR([cannot get it])
])
AC_MSG_RESULT([$unix_path_max])
AC_DEFINE_UNQUOTED([UNIX_PATH_MAX], $unix_path_max, [Custom value for UNIX_PATH_MAX])
])
dnl tgetent, tputs and UP [sic] are all required. They come from the lower
dnl tinfo library, but might be part of ncurses directly.
PKG_CHECK_MODULES([LIBTINFO], [tinfo], [], [
PKG_CHECK_MODULES([LIBTINFO], [ncurses])
])
AC_CHECK_LIB([ncurses], [tputs], [], [
AC_MSG_ERROR(['ncurses' library not found, or it doesn't contain 'tputs'])
])
AC_CHECK_LIB([ncurses], [UP], [], [
AC_MSG_ERROR(['ncurses' library not found, or it doesn't contain 'UP'])
])
LIBS="$old_LIBS"
AC_SUBST([LIBTINFO_CFLAGS])
AC_SUBST([LIBTINFO_LIBS])
dnl GNU gettext tools (optional).
AC_CHECK_PROG([XGETTEXT],[xgettext],[xgettext],[no])
@@ -352,6 +385,9 @@ AC_MSG_RESULT([$msgfmt_is_gnu])
AM_CONDITIONAL([HAVE_GNU_GETTEXT],
[test "x$XGETTEXT" != "xno" && test "x$MSGCAT" != "xno" && test "x$MSGFMT" != "xno" && test "x$MSGMERGE" != "xno" && test "x$msgfmt_is_gnu" != "xno"])
dnl Check for gettext.
AM_GNU_GETTEXT([external])
dnl Default backend.
AC_MSG_CHECKING([if the user specified a default backend])
AC_ARG_WITH([default-backend],
@@ -553,6 +589,13 @@ AC_ARG_WITH([extra-packages],
[EXTRA_PACKAGES=])
AC_SUBST([EXTRA_PACKAGES])
dnl Check for libdl/dlopen (optional - only used to test if the library
dnl can be used with libdl).
AC_CHECK_LIB([dl],[dlopen],[have_libdl=yes],[have_libdl=no])
AC_CHECK_HEADERS([dlfcn.h],[have_dlfcn=yes],[have_dlfcn=no])
AM_CONDITIONAL([HAVE_LIBDL],
[test "x$have_libdl" = "xyes" && test "x$have_dlfcn" = "xyes"])
dnl Check for rpcgen and XDR library. rpcgen is optional.
AC_CHECK_PROG([RPCGEN],[rpcgen],[rpcgen],[no])
AM_CONDITIONAL([HAVE_RPCGEN],[test "x$RPCGEN" != "xno"])
@@ -648,10 +691,8 @@ AC_CHECK_PROG([PO4A],[po4a],[po4a],[no])
AM_CONDITIONAL([HAVE_PO4A], [test "x$PO4A" != "xno"])
dnl Check for db_dump, db_load (optional).
AC_PATH_PROGS([DB_DUMP],
[db_dump db5.1_dump db4_dump db4.8_dump db4.7_dump db4.6_dump],[no])
AC_PATH_PROGS([DB_LOAD],
[db_load db5.1_load db4_load db4.8_load db4.7_load db4.6_load],[no])
GUESTFS_FIND_DB_TOOL([DB_DUMP], [dump])
GUESTFS_FIND_DB_TOOL([DB_LOAD], [load])
if test "x$DB_DUMP" != "xno"; then
AC_DEFINE_UNQUOTED([DB_DUMP],["$DB_DUMP"],[Name of db_dump program.])
fi
@@ -714,14 +755,22 @@ if test "x$YACC" = "xyacc"; then
AC_MSG_FAILURE([GNU 'bison' is required (yacc won't work).])
fi
dnl zip/unzip, used by virt-v2v
AC_PATH_PROGS([ZIP],[zip],[no])
AC_DEFINE_UNQUOTED([ZIP],["$ZIP"],[Name of zip program.])
AM_CONDITIONAL([HAVE_ZIP],[test "x$ZIP" != "xno"])
AC_PATH_PROGS([UNZIP],[unzip],[no])
AC_DEFINE_UNQUOTED([UNZIP],["$UNZIP"],[Name of unzip program.])
dnl Check for QEMU for running binaries on this $host_cpu, fall
dnl back to basic 'qemu'. Allow the user to override it.
qemu_system="$(
echo qemu-system-$host_cpu |
$SED -e 's/-i@<:@456@:>@86/-i386/g' \
-e 's/-arm.*/-arm/g'
)"
default_qemu="qemu-kvm kvm $qemu_system qemu"
AS_CASE([$host_cpu],
[i@<:@456@:>@86],[qemu_cpu=i386],
[arm*],[qemu_cpu=arm],
[amd64],[qemu_cpu=x86_64],
[powerpc64 | ppc64le | powerpc64le],[qemu_cpu=ppc64],
[qemu_cpu=$host_cpu])
default_qemu="qemu-kvm kvm qemu-system-$qemu_cpu qemu"
AC_ARG_WITH([qemu],
[AS_HELP_STRING([--with-qemu="bin1 bin2 ..."],
[set default QEMU binary @<:@default="[qemu-kvm] qemu-system-<host> qemu"@:>@])],
@@ -966,12 +1015,19 @@ PKG_CHECK_MODULES([HIVEX], [hivex],[
AM_CONDITIONAL([HAVE_HIVEX],[test "x$HIVEX_LIBS" != "x"])
dnl systemd journal library (optional)
PKG_CHECK_MODULES([SD_JOURNAL], [libsystemd-journal >= 196],[
PKG_CHECK_MODULES([SD_JOURNAL], [libsystemd],[
AC_SUBST([SD_JOURNAL_CFLAGS])
AC_SUBST([SD_JOURNAL_LIBS])
AC_DEFINE([HAVE_SD_JOURNAL],[1],[systemd journal library found at compile time.])
],
[AC_MSG_WARN([systemd journal library not found, some features will be disabled])])
],[
PKG_CHECK_MODULES([SD_JOURNAL], [libsystemd-journal >= 196],[
AC_SUBST([SD_JOURNAL_CFLAGS])
AC_SUBST([SD_JOURNAL_LIBS])
AC_DEFINE([HAVE_SD_JOURNAL],[1],[systemd journal library found at compile time.])
],[
AC_MSG_WARN([systemd journal library not found, some features will be disabled])
])
])
dnl FUSE is optional to build the FUSE module.
AC_ARG_ENABLE([fuse],
@@ -995,7 +1051,7 @@ AS_IF([test "x$enable_fuse" != "xno"],[
AM_CONDITIONAL([HAVE_FUSE],[test "x$enable_fuse" != "xno"])
dnl Check for yajl JSON library (optional).
PKG_CHECK_MODULES([YAJL], [yajl >= 2], [
PKG_CHECK_MODULES([YAJL], [yajl >= 2.0.4], [
AC_SUBST([YAJL_CFLAGS])
AC_SUBST([YAJL_LIBS])
AC_DEFINE([HAVE_YAJL],[1],[Define to 1 if you have yajl.])
@@ -1080,6 +1136,12 @@ AC_CHECK_PROG([OCAML_GETTEXT],[ocaml-gettext],[ocaml-gettext],[no])
AM_CONDITIONAL([HAVE_OCAML_GETTEXT],
[test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno" && test "x$OCAML_PKG_gettext" != "xno" && test "x$OCAML_GETTEXT" != "xno"])
dnl Flags we want to pass to every OCaml compiler call.
OCAML_WARN_ERROR="-warn-error CDEFLMPSUVYZX-3"
AC_SUBST([OCAML_WARN_ERROR])
OCAML_FLAGS="-g -annot"
AC_SUBST([OCAML_FLAGS])
dnl Check for Perl (optional, for Perl bindings and Perl tools).
AC_ARG_ENABLE([perl],
AS_HELP_STRING([--disable-perl], [disable Perl language bindings]),
@@ -1211,9 +1273,15 @@ AS_IF([test "x$enable_ruby" != "xno"],[
libruby="$(cat conftest)"
rm conftest
AS_IF([test -n "$libruby"],[
ruby_cmd='puts RbConfig::CONFIG@<:@"libdir"@:>@'
echo running: $RUBY -rrbconfig -e \'$ruby_cmd\' >&AS_MESSAGE_LOG_FD
$RUBY -rrbconfig -e "$ruby_cmd" >conftest 2>&AS_MESSAGE_LOG_FD
libruby_libdir="$(cat conftest)"
rm conftest
test -n "$libruby_libdir" && libruby_libdir="-L$libruby_libdir"
AC_MSG_RESULT([-l$libruby])
AC_CHECK_LIB([$libruby],[ruby_init],
[have_libruby=1],[have_libruby=])
[have_libruby=1],[have_libruby=],[$libruby_libdir])
],[
AC_MSG_RESULT([not found])
])
@@ -1251,6 +1319,9 @@ if test "x$with_java" != "xno"; then
for d in \
/usr/lib/jvm/java \
/usr/lib/jvm/default-java \
/usr/lib/jvm/default \
/usr/lib/jvm/java-8-openjdk \
/usr/lib/jvm/java-7-openjdk \
/usr/lib/jvm/java-6-openjdk
do
if test -d $d && test -f $d/bin/java; then
@@ -1609,22 +1680,32 @@ mkdir -p \
dnl http://www.mail-archive.com/automake@gnu.org/msg10204.html
AC_CONFIG_FILES([appliance/libguestfs-make-fixed-appliance],
[chmod +x,-w appliance/libguestfs-make-fixed-appliance])
AC_CONFIG_FILES([builder/link.sh],
[chmod +x,-w builder/link.sh])
AC_CONFIG_FILES([customize/link.sh],
[chmod +x,-w customize/link.sh])
AC_CONFIG_FILES([inspector/test-xmllint.sh],
[chmod +x,-w inspector/test-xmllint.sh])
AC_CONFIG_FILES([p2v-iso/kickstart-target.sh],
[chmod +x,-w p2v-iso/kickstart-target.sh])
AC_CONFIG_FILES([p2v-iso/virt-builder-target.sh],
[chmod +x,-w p2v-iso/virt-builder-target.sh])
AC_CONFIG_FILES([mllib/link.sh],
[chmod +x,-w mllib/link.sh])
AC_CONFIG_FILES([p2v/virt-p2v-make-disk],
[chmod +x,-w p2v/virt-p2v-make-disk])
AC_CONFIG_FILES([p2v/virt-p2v-make-kickstart],
[chmod +x,-w p2v/virt-p2v-make-kickstart])
AC_CONFIG_FILES([php/extension/php-for-tests.sh],
[chmod +x,-w php/extension/php-for-tests.sh])
AC_CONFIG_FILES([pick-guests.pl],
[chmod +x,-w pick-guests.pl])
AC_CONFIG_FILES([podwrapper.pl],
[chmod +x,-w podwrapper.pl])
AC_CONFIG_FILES([resize/link.sh],
[chmod +x,-w resize/link.sh])
AC_CONFIG_FILES([run],
[chmod +x,-w run])
AC_CONFIG_FILES([sparsify/link.sh],
[chmod +x,-w sparsify/link.sh])
AC_CONFIG_FILES([sysprep/link.sh],
[chmod +x,-w sysprep/link.sh])
AC_CONFIG_FILES([v2v/link.sh],
[chmod +x,-w v2v/link.sh])
@@ -1672,7 +1753,6 @@ AC_CONFIG_FILES([Makefile
ocaml/Makefile
ocaml/examples/Makefile
p2v/Makefile
p2v-iso/Makefile
perl/Makefile
perl/Makefile.PL
perl/examples/Makefile
@@ -1733,7 +1813,8 @@ AC_CONFIG_FILES([Makefile
tests/xfs/Makefile
tests/xml/Makefile
tools/Makefile
v2v/Makefile])
v2v/Makefile
v2v/test-v2v-networks-and-bridges.xml])
AC_OUTPUT
dnl Produce summary.

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# libguestfs autobuild script
# Copyright (C) 2009-2014 Red Hat Inc.
# Copyright (C) 2009-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

View File

@@ -1,6 +1,6 @@
#!/usr/bin/perl -w
# libguestfs
# Copyright (C) 2009-2014 Red Hat Inc.
# Copyright (C) 2009-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

View File

@@ -1,7 +1,7 @@
#!/usr/bin/ocamlrun /usr/bin/ocaml
(* Convert *.qtr (qemu block device trace) to Postscript.
* Copyright (C) 2009-2014 Red Hat Inc.
* Copyright (C) 2009-2015 Red Hat Inc.
* By Richard W.M. Jones <rjones@redhat.com>.
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -18,12 +18,12 @@
include $(top_srcdir)/subdir-rules.mk
EXTRA_DIST = \
$(SOURCES) \
$(SOURCES_MLI) $(SOURCES_ML) $(SOURCES_C) \
test-virt-customize.sh \
virt-customize.pod
CLEANFILES = \
*~ *.cmi *.cmo *.cmx *.cmxa *.o \
*~ *.annot *.cmi *.cmo *.cmx *.cmxa *.o \
stamp-virt-customize.pod \
virt-customize virt-customize.1
@@ -33,70 +33,68 @@ generator_built = \
customize-options.pod \
customize-synopsis.pod
# Alphabetical order.
SOURCES = \
crypt.ml \
SOURCES_MLI = \
crypt.mli \
crypt-c.c \
customize_cmdline.ml \
customize_cmdline.mli \
customize_run.ml \
customize_run.mli \
firstboot.ml \
firstboot.mli \
hostname.ml \
hostname.mli \
customize_main.ml \
password.ml \
password.mli \
perl_edit.ml \
perl_edit.mli \
random_seed.ml \
random_seed.mli \
timezone.ml \
ssh_key.mli \
timezone.mli \
urandom.ml \
urandom.mli
# This list must be in dependency order.
SOURCES_ML = \
customize_utils.ml \
crypt.ml \
firstboot.ml \
hostname.ml \
urandom.ml \
password.ml \
perl_edit.ml \
random_seed.ml \
ssh_key.ml \
timezone.ml \
customize_cmdline.ml \
customize_run.ml \
customize_main.ml
SOURCES_C = \
$(top_srcdir)/fish/uri.c \
$(top_srcdir)/fish/file-edit.c \
$(top_srcdir)/fish/file-edit.h \
$(top_srcdir)/mllib/uri-c.c \
crypt-c.c \
perl_edit-c.c
if HAVE_OCAML
deps = \
$(top_builddir)/fish/guestfish-uri.o \
$(top_builddir)/mllib/common_gettext.cmx \
$(top_builddir)/mllib/common_utils.cmx \
$(top_builddir)/mllib/config.cmx \
$(top_builddir)/mllib/regedit.cmx \
$(top_builddir)/mllib/uri-c.o \
$(top_builddir)/mllib/uRI.cmx \
crypt-c.o
bin_PROGRAMS = virt-customize
if HAVE_OCAMLOPT
OBJECTS = $(deps)
else
OBJECTS = $(patsubst %.cmx,%.cmo,$(deps))
endif
virt_customize_SOURCES = $(SOURCES_C)
virt_customize_CPPFLAGS = \
-I. \
-I$(top_builddir) \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
-I$(shell $(OCAMLC) -where) \
-I$(top_srcdir)/src \
-I$(top_srcdir)/fish
virt_customize_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(LIBVIRT_CFLAGS) \
$(LIBXML2_CFLAGS)
# This list must be in dependency order.
ocaml_modules = \
crypt \
firstboot \
hostname \
urandom \
password \
perl_edit \
random_seed \
timezone \
customize_cmdline \
customize_run \
customize_main
if HAVE_OCAMLOPT
OBJECTS += $(patsubst %,%.cmx,$(ocaml_modules))
else
OBJECTS += $(patsubst %,%.cmo,$(ocaml_modules))
endif
bin_SCRIPTS = virt-customize
BOBJECTS = \
$(top_builddir)/mllib/common_gettext.cmo \
$(top_builddir)/mllib/common_utils.cmo \
$(top_builddir)/mllib/config.cmo \
$(top_builddir)/mllib/regedit.cmo \
$(top_builddir)/mllib/uRI.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
@@ -104,53 +102,39 @@ bin_SCRIPTS = virt-customize
OCAMLPACKAGES = \
-package str,unix \
-I $(top_builddir)/src/.libs \
-I $(top_builddir)/gnulib/lib/.libs \
-I $(top_builddir)/ocaml \
-I $(top_builddir)/mllib
if HAVE_OCAML_PKG_GETTEXT
OCAMLPACKAGES += -package gettext-stub
endif
OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX-3 $(OCAMLPACKAGES)
OCAMLOPTFLAGS = $(OCAMLCFLAGS)
OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR)
OCAMLCLIBS = \
$(LIBXML2_LIBS) -lncurses -lcrypt \
-L../src/.libs -lutils \
-L../gnulib/lib/.libs -lgnu
virt-customize: $(OBJECTS)
if HAVE_OCAMLOPT
$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) \
mlguestfs.cmxa -linkpkg $^ \
-cclib '$(OCAMLCLIBS)' \
-o $@
if !HAVE_OCAMLOPT
OBJECTS = $(BOBJECTS)
BEST = c
OCAMLLINKFLAGS = mlguestfs.cma -custom
else
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) \
mlguestfs.cma -linkpkg $^ \
-cclib '$(OCAMLCLIBS)' \
-custom \
-o $@
OBJECTS = $(XOBJECTS)
BEST = opt
OCAMLLINKFLAGS = mlguestfs.cmxa
endif
virt_customize_DEPENDENCIES = $(OBJECTS)
virt_customize_LINK = \
./link.sh \
$(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 $@
# automake will decide we don't need C support in this file. Really
# we do, so we have to provide it ourselves.
DEFAULT_INCLUDES = \
-I. \
-I$(top_builddir) \
-I$(shell $(OCAMLC) -where) \
-I$(top_srcdir)/src \
-I$(top_srcdir)/fish
.c.o:
$(CC) $(CFLAGS) $(PROF_CFLAGS) $(DEFAULT_INCLUDES) -c $< -o $@
$(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
endif
# Manual pages and HTML files for the website.
man_MANS = virt-customize.1

View File

@@ -26,6 +26,8 @@
#include <caml/memory.h>
#include <caml/mlvalues.h>
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
value
virt_sysprep_crypt (value keyv, value saltv)
{

View File

@@ -19,6 +19,7 @@
open Common_gettext.Gettext
open Common_utils
open Customize_utils
open Customize_cmdline
open Printf
@@ -27,12 +28,13 @@ module G = Guestfs
let () = Random.self_init ()
let prog = Filename.basename Sys.executable_name
let main () =
let attach = ref [] in
let attach_format = ref None in
let set_attach_format = function
let attach_format_consumed = ref true in
let set_attach_format s =
attach_format_consumed := false;
match s with
| "auto" -> attach_format := None
| s -> attach_format := Some s
in
@@ -42,6 +44,11 @@ let main () =
let dryrun = ref false in
let files = ref [] in
let format = ref "auto" in
let format_consumed = ref true in
let set_format s =
format := s;
format_consumed := false
in
let libvirturi = ref "" in
let memsize = ref None in
let set_memsize arg = memsize := Some arg in
@@ -59,15 +66,14 @@ let main () =
let uri =
try URI.parse_uri arg
with Invalid_argument "URI.parse_uri" ->
eprintf "Error parsing URI '%s'. Look for error messages printed above.\n" arg;
exit 1 in
error (f_"error parsing URI '%s'. Look for error messages printed above.")
arg in
let format = match !format with "auto" -> None | fmt -> Some fmt in
files := (uri, format) :: !files
files := (uri, format) :: !files;
format_consumed := true
and set_domain dom =
if !domain <> None then (
eprintf (f_"%s: --domain option can only be given once\n") prog;
exit 1
);
if !domain <> None then
error (f_"--domain option can only be given once");
domain := Some dom
in
@@ -85,8 +91,9 @@ let main () =
"-n", Arg.Set dryrun, " " ^ s_"Perform a dry run";
"--dryrun", Arg.Set dryrun, " " ^ s_"Perform a dry run";
"--dry-run", Arg.Set dryrun, " " ^ s_"Perform a dry run";
"--format", Arg.Set_string format, s_"format" ^ " " ^ s_"Set format (default: auto)";
"--format", Arg.String set_format, s_"format" ^ " " ^ s_"Set format (default: auto)";
"--long-options", Arg.Unit display_long_options, " " ^ s_"List long options";
"--short-options", Arg.Unit display_short_options, " " ^ s_"List short options";
"-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)";
@@ -101,7 +108,7 @@ let main () =
"-x", Arg.Set trace, " " ^ s_"Enable tracing of libguestfs calls";
] in
let customize_argspec, get_customize_ops =
Customize_cmdline.argspec ~prog () in
Customize_cmdline.argspec () in
let customize_argspec =
List.map (fun (spec, _, _) -> spec) customize_argspec in
let argspec = argspec @ customize_argspec in
@@ -129,6 +136,12 @@ read the man page virt-customize(1).
prog in
Arg.parse argspec anon_fun usage_msg;
if not !format_consumed then
error (f_"--format parameter must appear before -a parameter");
if not !attach_format_consumed then
error (f_"--attach-format parameter must appear before --attach parameter");
(* Check -a and -d options. *)
let files = !files in
let domain = !domain in
@@ -136,9 +149,7 @@ read the man page virt-customize(1).
let add =
match files, domain with
| [], None ->
eprintf (f_"%s: you must give either -a or -d options\n") prog;
eprintf (f_"Read virt-customize(1) man page for further information.\n");
exit 1
error (f_"you must give either -a or -d options. Read virt-customize(1) man page for further information.")
| [], Some dom ->
fun (g : Guestfs.guestfs) readonly ->
let allowuuid = true in
@@ -149,9 +160,7 @@ read the man page virt-customize(1).
?libvirturi ~allowuuid ~readonlydisk
dom)
| _, Some _ ->
eprintf (f_"%s: you cannot give -a and -d options together\n") prog;
eprintf (f_"Read virt-customize(1) man page for further information.\n");
exit 1
error (f_"you cannot give -a and -d options together. Read virt-customize(1) man page for further information.")
| files, None ->
fun g readonly ->
List.iter (
@@ -193,7 +202,11 @@ read the man page virt-customize(1).
(match memsize with None -> () | Some memsize -> g#set_memsize memsize);
(match smp with None -> () | Some smp -> g#set_smp smp);
g#set_network 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;
(* Add disks. *)
add g dryrun;
@@ -210,8 +223,7 @@ read the man page virt-customize(1).
(* Inspection. *)
(match Array.to_list (g#inspect_os ()) with
| [] ->
eprintf (f_"%s: no operating systems were found in the guest image\n") prog;
exit 1
error (f_"no operating systems were found in the guest image")
| roots ->
List.iter (
fun root ->
@@ -224,11 +236,11 @@ read the man page virt-customize(1).
List.iter (
fun (mp, dev) ->
try g#mount dev mp;
with Guestfs.Error msg -> eprintf (f_"%s (ignored)\n") msg
with Guestfs.Error msg -> warning (f_"%s (ignored)") msg
) mps;
(* Do the customization. *)
Customize_run.run ~prog ~verbose ~quiet g root ops;
Customize_run.run ~verbose ~quiet g root ops;
g#umount_all ();
) roots;
@@ -242,25 +254,4 @@ read the man page virt-customize(1).
Gc.compact ()
(* Finished. *)
let () =
(try main ()
with
| Failure msg -> (* from failwith/failwithf *)
eprintf (f_"%s: %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 ->
eprintf (f_"%s: exception: %s\n") prog (Printexc.to_string exn);
exit 1
);
exit 0
let () = run_main_and_handle_errors ~prog main

View File

@@ -22,12 +22,11 @@ open Printf
open Common_gettext.Gettext
open Common_utils
open Customize_utils
open Customize_cmdline
open Password
let quote = Filename.quote
let run ~prog ~verbose ~quiet (g : Guestfs.guestfs) root (ops : ops) =
let run ~verbose ~quiet (g : Guestfs.guestfs) root (ops : ops) =
(* Timestamped messages in ordinary, non-debug non-quiet mode. *)
let msg fs = make_message_function ~quiet fs in
@@ -50,8 +49,7 @@ let run ~prog ~verbose ~quiet (g : Guestfs.guestfs) root (ops : ops) =
*)
g#download logfile "/dev/stderr"
with exn ->
eprintf (f_"%s: log file %s: %s (ignored)\n")
prog logfile (Printexc.to_string exn) in
warning (f_"log file %s: %s (ignored)") logfile (Printexc.to_string exn) in
(* Useful wrapper for scripts. *)
let do_run ~display cmd =
@@ -75,13 +73,12 @@ exec >>%s 2>&1
%s
" (quote logfile) env_vars cmd in
if verbose then eprintf "running command:\n%s\n%!" cmd;
if verbose then printf "running command:\n%s\n%!" cmd;
try ignore (g#sh cmd)
with
Guestfs.Error msg ->
debug_logfile ();
eprintf (f_"%s: %s: command exited with an error\n") prog display;
exit 1
error (f_"%s: command exited with an error") display
in
(* http://distrowatch.com/dwres.php?resource=package-management *)
@@ -96,6 +93,8 @@ exec >>%s 2>&1
apt-get $apt_opts update
apt-get $apt_opts install %s
" quoted_args
| "dnf" ->
sprintf "dnf -y install %s" quoted_args
| "pisi" ->
sprintf "pisi it %s" quoted_args
| "pacman" ->
@@ -108,13 +107,9 @@ exec >>%s 2>&1
(* XXX Should we use -n option? *)
sprintf "zypper in %s" quoted_args
| "unknown" ->
eprintf (f_"%s: --install is not supported for this guest operating system\n")
prog;
exit 1
error (f_"--install is not supported for this guest operating system")
| pm ->
eprintf (f_"%s: sorry, don't know how to use --install with the '%s' package manager\n")
prog pm;
exit 1
error (f_"sorry, don't know how to use --install with the '%s' package manager") pm
and guest_update_command () =
match g#inspect_get_package_management root with
@@ -126,6 +121,8 @@ exec >>%s 2>&1
apt-get $apt_opts update
apt-get $apt_opts upgrade
"
| "dnf" ->
sprintf "dnf -y update"
| "pisi" ->
sprintf "pisi upgrade"
| "pacman" ->
@@ -137,19 +134,15 @@ exec >>%s 2>&1
| "zypper" ->
sprintf "zypper update"
| "unknown" ->
eprintf (f_"%s: --update is not supported for this guest operating system\n")
prog;
exit 1
error (f_"--update is not supported for this guest operating system")
| pm ->
eprintf (f_"%s: sorry, don't know how to use --update with the '%s' package manager\n")
prog pm;
exit 1
error (f_"sorry, don't know how to use --update with the '%s' package manager") pm
in
(* Set the random seed. *)
msg (f_"Setting a random seed");
if not (Random_seed.set_random_seed g root) then
warning ~prog (f_"random seed could not be set for this type of guest");
warning (f_"random seed could not be set for this type of guest");
(* Used for numbering firstboot commands. *)
let i = ref 0 in
@@ -157,11 +150,8 @@ exec >>%s 2>&1
(* Store the passwords and set them all at the end. *)
let passwords = Hashtbl.create 13 in
let set_password user pw =
if Hashtbl.mem passwords user then (
eprintf (f_"%s: error: multiple --root-password/--password options set the password for user '%s' twice.\n")
prog user;
exit 1
);
if Hashtbl.mem passwords user then
error (f_"multiple --root-password/--password options set the password for user '%s' twice") user;
Hashtbl.replace passwords user pw
in
@@ -187,36 +177,33 @@ exec >>%s 2>&1
| `Edit (path, expr) ->
msg (f_"Editing: %s") path;
if not (g#is_file path) then (
eprintf (f_"%s: error: %s is not a regular file in the guest\n")
prog path;
exit 1
);
if not (g#is_file path) then
error (f_"%s is not a regular file in the guest") path;
Perl_edit.edit_file ~verbose g path expr
Perl_edit.edit_file ~verbose g#ocaml_handle path expr
| `FirstbootCommand cmd ->
incr i;
msg (f_"Installing firstboot command: [%d] %s") !i cmd;
Firstboot.add_firstboot_script ~prog g root !i cmd
Firstboot.add_firstboot_script g root !i cmd
| `FirstbootPackages pkgs ->
incr i;
msg (f_"Installing firstboot packages: [%d] %s") !i
(String.concat " " pkgs);
let cmd = guest_install_command pkgs in
Firstboot.add_firstboot_script ~prog g root !i cmd
Firstboot.add_firstboot_script g root !i cmd
| `FirstbootScript script ->
incr i;
msg (f_"Installing firstboot script: [%d] %s") !i script;
let cmd = read_whole_file script in
Firstboot.add_firstboot_script ~prog g root !i cmd
Firstboot.add_firstboot_script g root !i cmd
| `Hostname hostname ->
msg (f_"Setting the hostname: %s") hostname;
if not (Hostname.set_hostname g root hostname) then
warning ~prog (f_"hostname could not be set for this type of guest")
warning (f_"hostname could not be set for this type of guest")
| `InstallPackages pkgs ->
msg (f_"Installing packages: %s") (String.concat " " pkgs);
@@ -249,10 +236,18 @@ exec >>%s 2>&1
msg (f_"Scrubbing: %s") path;
g#scrub_file path
| `SSHInject (user, selector) ->
(match g#inspect_get_type root with
| "linux" | "freebsd" | "netbsd" | "openbsd" | "hurd" ->
msg (f_"SSH key inject: %s") user;
Ssh_key.do_ssh_inject_unix g user selector
| _ ->
warning (f_"SSH key could be injected for this type of guest"))
| `Timezone tz ->
msg (f_"Setting the timezone: %s") tz;
if not (Timezone.set_timezone ~prog g root tz) then
warning ~prog (f_"timezone could not be set for this type of guest")
if not (Timezone.set_timezone g root tz) then
warning (f_"timezone could not be set for this type of guest")
| `Update ->
msg (f_"Updating core packages");
@@ -289,10 +284,10 @@ exec >>%s 2>&1
| "linux" ->
msg (f_"Setting passwords");
let password_crypto = ops.flags.password_crypto in
set_linux_passwords ~prog ?password_crypto g root passwords
set_linux_passwords ?password_crypto g root passwords
| _ ->
warning ~prog (f_"passwords could not be set for this type of guest")
warning (f_"passwords could not be set for this type of guest")
);
if ops.flags.selinux_relabel then (
@@ -331,6 +326,6 @@ exec >>%s 2>&1
(try ignore (g#debug "sh" [| "fuser"; "-k"; "/sysroot" |])
with exn ->
if verbose then
eprintf (f_"%s: %s (ignored)\n") prog (Printexc.to_string exn)
printf (f_"%s: %s (ignored)\n") prog (Printexc.to_string exn)
);
g#ping_daemon () (* tiny delay after kill *)

View File

@@ -23,4 +23,4 @@
* filesystems must be mounted up.
*)
val run : prog:string -> verbose:bool -> quiet:bool -> Guestfs.guestfs -> string -> Customize_cmdline.ops -> unit
val run : verbose:bool -> quiet:bool -> Guestfs.guestfs -> string -> Customize_cmdline.ops -> unit

View File

@@ -0,0 +1,30 @@
(* virt-customize
* Copyright (C) 2013-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.
*)
(* Utilities/common functions used in virt-customize only. *)
open Printf
open Common_utils
let prog = Filename.basename Sys.executable_name
let error ?exit_code fs = error ~prog ?exit_code fs
let warning fs = warning ~prog fs
let info fs = info ~prog fs
let quote = Filename.quote

View File

@@ -1,5 +1,5 @@
(* virt-customize
* Copyright (C) 2012-2014 Red Hat Inc.
* Copyright (C) 2012-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
@@ -21,6 +21,7 @@ open Printf
open Common_utils
open Common_gettext.Gettext
open Customize_utils
open Regedit
(* For Linux guests. *)
@@ -46,23 +47,28 @@ module Linux = struct
### END INIT INFO
d=%s/scripts
d_done=%s/scripts-done
logfile=~root/virt-sysprep-firstboot.log
echo \"$0\" \"$@\" 2>&1 | tee $logfile
echo \"Scripts dir: $d\" 2>&1 | tee $logfile
echo \"$0\" \"$@\" 2>&1 | tee -a $logfile
echo \"Scripts dir: $d\" 2>&1 | tee -a $logfile
if test \"$1\" = \"start\"
then
mkdir -p $d_done
for f in $d/* ; do
if test -x \"$f\"
then
echo '=== Running' $f '===' 2>&1 | tee $logfile
$f 2>&1 | tee $logfile
rm -f $f
# move the script to the 'scripts-done' directory, so it is not
# executed again at the next boot
mv $f $d_done
echo '=== Running' $f '===' 2>&1 | tee -a $logfile
$d_done/$(basename $f) 2>&1 | tee -a $logfile
fi
done
rm -f $d_done/*
fi
" firstboot_dir
" firstboot_dir firstboot_dir
let firstboot_service = sprintf "\
[Unit]
@@ -81,7 +87,7 @@ StandardError=inherit
WantedBy=default.target
" firstboot_dir
let rec install_service ~prog (g : Guestfs.guestfs) distro =
let rec install_service (g : Guestfs.guestfs) distro =
g#mkdir_p firstboot_dir;
g#mkdir_p (sprintf "%s/scripts" firstboot_dir);
g#write (sprintf "%s/firstboot.sh" firstboot_dir) firstboot_sh;
@@ -97,7 +103,7 @@ WantedBy=default.target
if g#is_dir "/etc/systemd/system" then
install_systemd_service g;
if g#is_dir "/etc/rc.d" || g#is_dir "/etc/init.d" then
install_sysvinit_service ~prog g distro
install_sysvinit_service g distro
(* Install the systemd firstboot service, if not installed already. *)
and install_systemd_service g =
@@ -106,7 +112,7 @@ WantedBy=default.target
g#ln_sf (sprintf "%s/firstboot.service" firstboot_dir)
"/etc/systemd/system/default.target.wants"
and install_sysvinit_service ~prog g = function
and install_sysvinit_service g = function
| "fedora"|"rhel"|"centos"|"scientificlinux"|"redhat-based" ->
install_sysvinit_redhat g
| "opensuse"|"sles"|"suse-based" ->
@@ -114,7 +120,7 @@ WantedBy=default.target
| "debian"|"ubuntu" ->
install_sysvinit_debian g
| distro ->
error ~prog (f_"guest type %s is not supported") distro
error (f_"guest type %s is not supported") distro
and install_sysvinit_redhat g =
g#mkdir_p "/etc/rc.d/rc2.d";
@@ -158,7 +164,7 @@ end
module Windows = struct
let rec install_service ~prog (g : Guestfs.guestfs) root =
let rec install_service (g : Guestfs.guestfs) root =
(* Get the data directory. *)
let virt_tools_data_dir =
try Sys.getenv "VIRT_TOOLS_DATA_DIR"
@@ -174,7 +180,7 @@ module Windows = struct
close_in chan
with
Sys_error msg ->
error ~prog (f_"'%s' is missing. This file is required in order to install Windows firstboot scripts. You can get it by building rhsrvany (https://github.com/rwmjones/rhsrvany). Original error: %s")
error (f_"'%s' is missing. This file is required in order to install Windows firstboot scripts. You can get it by building rhsrvany (https://github.com/rwmjones/rhsrvany). Original error: %s")
rhsrvany_exe msg
);
@@ -261,12 +267,12 @@ module Windows = struct
end
let add_firstboot_script ~prog (g : Guestfs.guestfs) root i content =
let add_firstboot_script (g : Guestfs.guestfs) root i content =
let typ = g#inspect_get_type root in
let distro = g#inspect_get_distro root in
match typ, distro with
| "linux", _ ->
Linux.install_service ~prog g distro;
Linux.install_service g distro;
let t = Int64.of_float (Unix.time ()) in
let r = string_random8 () in
let filename = sprintf "%s/scripts/%04d-%Ld-%s" Linux.firstboot_dir i t r in
@@ -274,11 +280,11 @@ let add_firstboot_script ~prog (g : Guestfs.guestfs) root i content =
g#chmod 0o755 filename
| "windows", _ ->
let firstboot_dir = Windows.install_service ~prog g root in
let firstboot_dir = Windows.install_service g root in
let t = Int64.of_float (Unix.time ()) in
let r = string_random8 () in
let filename = sprintf "%s/scripts/%04d-%Ld-%s.bat" firstboot_dir i t r in
g#write filename content
| _ ->
error ~prog (f_"guest type %s/%s is not supported") typ distro
error (f_"guest type %s/%s is not supported") typ distro

View File

@@ -1,5 +1,5 @@
(* virt-customize
* Copyright (C) 2012-2014 Red Hat Inc.
* Copyright (C) 2012-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,8 +16,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
val add_firstboot_script : prog:string -> Guestfs.guestfs -> string -> int -> string -> unit
(** [add_firstboot_script ~prog g root idx content] adds a firstboot
val add_firstboot_script : Guestfs.guestfs -> string -> int -> string -> unit
(** [add_firstboot_script g root idx content] adds a firstboot
script called [shortname] containing [content].
NB. [content] is the contents of the script, {b not} a filename.

View File

@@ -1,5 +1,5 @@
(* virt-sysprep
* Copyright (C) 2012-2014 Red Hat Inc.
* Copyright (C) 2012-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

View File

@@ -1,5 +1,5 @@
(* virt-sysprep
* Copyright (C) 2012-2014 Red Hat Inc.
* Copyright (C) 2012-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

22
customize/link.sh.in Normal file
View File

@@ -0,0 +1,22 @@
# libguestfs Makefile.am
# @configure_input@
# (C) Copyright 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., 675 Mass Ave, Cambridge, MA 02139, USA.
# Hack automake to link binary properly. There is no other way to add
# the -cclib parameter to the end of the command line.
exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ -lcrypt @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'

View File

@@ -1,5 +1,5 @@
(* virt-sysprep
* Copyright (C) 2012-2014 Red Hat Inc.
* Copyright (C) 2012-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
@@ -18,6 +18,9 @@
open Common_gettext.Gettext
open Common_utils
open Customize_utils
open Printf
type password_crypto = [`MD5 | `SHA256 | `SHA512 ]
@@ -40,23 +43,21 @@ let make_random_password =
let chars = "ABCDEFGHIJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz0123456789" in
fun () -> Urandom.urandom_uniform 16 chars
let password_crypto_of_string ~prog = function
let password_crypto_of_string = function
| "md5" -> `MD5
| "sha256" -> `SHA256
| "sha512" -> `SHA512
| arg ->
eprintf (f_"%s: password-crypto: unknown algorithm %s, use \"md5\", \"sha256\" or \"sha512\".\n")
prog arg;
exit 1
error (f_"password-crypto: unknown algorithm %s, use \"md5\", \"sha256\" or \"sha512\"") arg
let rec parse_selector ~prog arg =
parse_selector_list ~prog arg (string_nsplit ":" arg)
let rec parse_selector arg =
parse_selector_list arg (string_nsplit ":" arg)
and parse_selector_list ~prog orig_arg = function
and parse_selector_list orig_arg = function
| [ "lock"|"locked" ] ->
{ pw_locked = true; pw_password = Disabled_password }
| ("lock"|"locked") :: rest ->
let pw = parse_selector_list ~prog orig_arg rest in
let pw = parse_selector_list orig_arg rest in
{ pw with pw_locked = true }
| [ "file"; filename ] ->
{ pw_password = Password (read_password_from_file filename);
@@ -68,9 +69,7 @@ and parse_selector_list ~prog orig_arg = function
| [ "disable"|"disabled" ] ->
{ pw_password = Disabled_password; pw_locked = false }
| _ ->
eprintf (f_"%s: invalid password selector '%s'; see the man page.\n")
prog orig_arg;
exit 1
error (f_"invalid password selector '%s'; see the man page") orig_arg
and read_password_from_file filename =
let chan = open_in filename in
@@ -81,50 +80,52 @@ and read_password_from_file filename =
(* Permissible characters in a salt. *)
let chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789./"
let rec set_linux_passwords ~prog ?password_crypto g root passwords =
let rec set_linux_passwords ?password_crypto (g : Guestfs.guestfs) root passwords =
let crypto =
match password_crypto with
| None -> default_crypto ~prog g root
| None -> default_crypto g root
| Some c -> c in
(* XXX Would like to use Augeas here, but Augeas doesn't support
* /etc/shadow (as of 1.1.0).
(* Create a (almost) empty temporary file with the attributes of
* /etc/shadow, so we can restore them later.
*)
let tempfile = g#mktemp "/etc/shadow.guestfsXXXXXX" in
g#write tempfile "*";
g#copy_attributes ~all:true "/etc/shadow" tempfile;
let shadow = Array.to_list (g#read_lines "/etc/shadow") in
let shadow =
List.map (
fun line ->
try
(* Each line is: "user:[!!]password:..."
* !! at the front of the password field means the account is locked.
* 'i' points to the first colon, 'j' to the second colon.
*)
let i = String.index line ':' in
let user = String.sub line 0 i in
let selector = Hashtbl.find passwords user in
let j = String.index_from line (i+1) ':' in
let rest = String.sub line j (String.length line - j) in
let pwfield =
match selector with
| { pw_locked = locked;
pw_password = Password password } ->
if locked then "!!" else "" ^ encrypt password crypto
| { pw_locked = locked;
pw_password = Random_password } ->
let password = make_random_password () in
printf (f_"Setting random password of %s to %s\n%!")
user password;
if locked then "!!" else "" ^ encrypt password crypto
| { pw_locked = true; pw_password = Disabled_password } -> "!!*"
| { pw_locked = false; pw_password = Disabled_password } -> "*" in
user ^ ":" ^ pwfield ^ rest
with Not_found -> line
) shadow in
g#aug_init "/" 0;
let users = Array.to_list (g#aug_ls "/files/etc/shadow") in
List.iter (
fun userpath ->
let user =
let i = String.rindex userpath '/' in
String.sub userpath (i+1) (String.length userpath -i-1) in
try
(* Each line is: "user:[!!]password:..."
* !! at the front of the password field means the account is locked.
*)
let selector = Hashtbl.find passwords user in
let pwfield =
match selector with
| { pw_locked = locked;
pw_password = Password password } ->
(if locked then "!!" else "") ^ encrypt password crypto
| { pw_locked = locked;
pw_password = Random_password } ->
let password = make_random_password () in
info (f_"Setting random password of %s to %s") user password;
(if locked then "!!" else "") ^ encrypt password crypto
| { pw_locked = true; pw_password = Disabled_password } -> "!!*"
| { pw_locked = false; pw_password = Disabled_password } -> "*" in
g#aug_set (userpath ^ "/password") pwfield
with Not_found -> ()
) users;
g#aug_save ();
g#aug_close ();
g#write "/etc/shadow" (String.concat "\n" shadow ^ "\n");
(* In virt-sysprep /.autorelabel will label it correctly. *)
g#chmod 0 "/etc/shadow"
(* Restore all the attributes from the temporary file, and remove it. *)
g#copy_attributes ~all:true tempfile "/etc/shadow";
g#rm tempfile
(* Encrypt each password. Use glibc (on the host). See:
* https://rwmj.wordpress.com/2013/07/09/setting-the-root-or-other-passwords-in-a-linux-guest/
@@ -145,7 +146,7 @@ and encrypt password crypto =
* precede this date only support md5, whereas all guests after this
* date can support sha512.
*)
and default_crypto ~prog g root =
and default_crypto g root =
let distro = g#inspect_get_distro root in
let major = g#inspect_get_major_version root in
match distro, major with
@@ -167,6 +168,6 @@ and default_crypto ~prog g root =
| "ubuntu", _ -> `MD5
| _, _ ->
warning ~prog (f_"password: using insecure md5 password encryption for
warning (f_"password: using insecure md5 password encryption for
guest of type %s version %d.\nIf this is incorrect, use --password-crypto option and file a bug.") distro major;
`MD5

View File

@@ -1,5 +1,5 @@
(* virt-sysprep
* Copyright (C) 2012-2014 Red Hat Inc.
* Copyright (C) 2012-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
@@ -18,7 +18,7 @@
type password_crypto = [ `MD5 | `SHA256 | `SHA512 ]
val password_crypto_of_string : prog:string -> string -> password_crypto
val password_crypto_of_string : string -> password_crypto
(** Parse --password-crypto parameter on command line. *)
type password_selector = {
@@ -30,13 +30,13 @@ and password =
| Random_password (** Choose a random password. *)
| Disabled_password (** [*] in the password field. *)
val parse_selector : prog:string -> string -> password_selector
val parse_selector : string -> password_selector
(** Parse the selector field in --password/--root-password. Note this
doesn't parse the username part. Exits if the format is not valid. *)
type password_map = (string, password_selector) Hashtbl.t
(** A map of username -> selector. *)
val set_linux_passwords : prog:string -> ?password_crypto:password_crypto -> Guestfs.guestfs -> string -> password_map -> unit
val set_linux_passwords : ?password_crypto:password_crypto -> Guestfs.guestfs -> string -> password_map -> unit
(** Adjust the passwords of a Linux guest according to the
password map. *)

View File

@@ -1,5 +1,5 @@
/* virt-resize - interface to isatty
* Copyright (C) 2013 Red Hat Inc.
/* virt-customize - interface to edit_file_perl
* 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
@@ -22,17 +22,33 @@
#include <stdlib.h>
#include <unistd.h>
#include <caml/alloc.h>
#include <caml/memory.h>
#include <caml/mlvalues.h>
/* RHEL 5-era ocaml didn't have Unix.isatty.
*
* Note this function is marked as "noalloc" so it must not call any
* OCaml allocation functions:
* http://camltastic.blogspot.co.uk/2008/08/tip-calling-c-functions-directly-with.html
#include "file-edit.h"
/**
* We try to reuse the internals of the OCaml binding (for extracting
* the guestfs handle, and raising errors); hopefully this should be safe,
* as long as it's kept internal within the libguestfs sources.
*/
#include "../ocaml/guestfs-c.h"
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
value
virt_resize_isatty_stdout (value unitv)
virt_customize_edit_file_perl (value verbosev, value gv, value filev,
value exprv)
{
return isatty (1) ? Val_true : Val_false;
CAMLparam4 (verbosev, gv, filev, exprv);
int r;
guestfs_h *g = Guestfs_val (gv);
r = edit_file_perl (g, String_val (filev), String_val (exprv), NULL,
Bool_val (verbosev));
if (r == -1)
ocaml_guestfs_raise_error (g, "edit_file_perl");
CAMLreturn (Val_unit);
}

Some files were not shown because too many files have changed in this diff Show More