Compare commits

...

1307 Commits

Author SHA1 Message Date
Richard W.M. Jones
9e0bb093e3 Version 1.59.2. 2026-01-26 15:00:54 +00:00
Richard W.M. Jones
45d0e66d02 tests/disks/debug-qemu.sh: Fix test for update QMP test
Commit f7a24b2ea8 ("lib/qemu.c: Use machine type none when inspecting
QMP properties") changed the number of command line parameters used
before the '-qmp stdio' option when libguestfs queries qemu features.
This broke some tests which rely on the exact order of parameters.

Fixes: commit f7a24b2ea8
Updates: commit 5da8102f5f
2026-01-26 14:59:13 +00:00
Richard W.M. Jones
7833461af7 generator: Deprecate xfs_info (replaced by xfs_info2)
Deprecate this function, and suggest using xfs_info2 as its
replacement.
2026-01-26 14:40:39 +00:00
Richard W.M. Jones
e1deb358ce daemon: Reimplement xfs_info using xfs_info2
Remove all the complicated old C parsing code and reimplement xfs_info
using xfs_info2.  Note that this function will be deprecated.
2026-01-26 14:40:39 +00:00
Richard W.M. Jones
dfd2700616 New API: xfs_info2
Reimplement xfs_info by returning a hash table of values (rather than
a limited struct), and by writing it in OCaml with PCRE which makes
string parsing a lot simpler.  This will now flexibly return all the
fields from the underlying xfs_info command, even (hopefully) future
fields.

Note the field values are returned as strings, because the actual
fields in xfs_info output are fairly random and free-form.  There is a
trade off here between returning as much information as we can, and
requiring the user to do a bit of (simple) field parsing.

Fixes: https://issues.redhat.com/browse/RHEL-143673
2026-01-26 14:40:39 +00:00
Richard W.M. Jones
1c9c03bcd4 generator: Fix description of xfs_info
The returned struct contains filesystem metadata, not "geometry
information" (whatever that means).
2026-01-26 14:40:39 +00:00
Richard W.M. Jones
6166304be6 generator: Fix description of xfs_growfs
This function does not return "geometry information".  Remove
the bogus description.
2026-01-26 14:40:39 +00:00
Richard W.M. Jones
f7a24b2ea8 lib/qemu.c: Use machine type none when inspecting QMP properties
Dan mentioned that there is a special machine type ("none") we can use
when querying for KVM.  It has no CPU, memory, etc and does not run,
but you can still enable KVM for it.

Note we have to remove the -cpu parameter, otherwise qemu prints this
error:

  qemu-kvm: apic-id property was not initialized properly

Updates: commit 5da8102f5f
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
2026-01-26 14:32:30 +00:00
Hosted Weblate
8dc104c2f0 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2026-01-22 10:48:55 +00:00
Nathan
589066f2b1 Translated using Weblate (Italian)
Currently translated at 1.4% (205 of 14137 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/it/
2026-01-22 10:48:55 +00:00
Richard W.M. Jones
1b79e22be4 generator/daemon.ml: Avoid not available macro for OCaml functions
Reported-by: Toolybird
Fixes: https://github.com/libguestfs/libguestfs/issues/290
2026-01-19 22:19:27 +00:00
Richard W.M. Jones
8b3fc15190 website/index.html.in: Fix stable/development branch links 2026-01-19 19:43:56 +00:00
Richard W.M. Jones
9ffe190fbe Version 1.59.1. 2026-01-19 19:42:01 +00:00
Richard W.M. Jones
da70ed1360 po: Keep LINGUAS files sorted 2026-01-19 18:51:36 +00:00
Nathan
bb649ff0ba Added translation using Weblate (Italian) 2026-01-19 18:51:01 +00:00
Temuri Doghonadze
f887d3cb54 Translated using Weblate (Georgian)
Currently translated at 16.6% (160 of 962 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/ka/
2026-01-19 18:51:01 +00:00
Hosted Weblate
0443ba7778 Update translation files
Updated by "Update LINGUAS file" hook in Weblate.

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/

Update translation files

Updated by "Update LINGUAS file" hook in Weblate.

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/

Update translation files

Updated by "Update LINGUAS file" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2026-01-19 18:51:01 +00:00
Languages add-on
b6bb5b96c2 Added translation using Weblate (Italian)
Added translation using Weblate (Telugu)

Added translation using Weblate (Tamil)

Added translation using Weblate (Russian)

Added translation using Weblate (Polish)

Added translation using Weblate (Punjabi)

Added translation using Weblate (Odia)

Added translation using Weblate (Marathi)

Added translation using Weblate (Malayalam)

Added translation using Weblate (Kannada)

Added translation using Weblate (Georgian)

Added translation using Weblate (Hindi)

Added translation using Weblate (Gujarati)

Added translation using Weblate (Portuguese (Brazil))
2026-01-19 18:51:01 +00:00
Richard W.M. Jones
548af2929e daemon/selinux.c: Fix compilation when no libselinux
/usr/bin/ld: /tmp/ccvSGq6E.ltrans7.ltrans.o:(.data.rel.ro+0x1f8): undefined reference to `optgroup_selinuxrelabel_available'

The reason is that we didn't include optgroup_selinuxrelabel_available
on the fallback / no libselinux code path.

Reported-by: David Runge
Thanks: Toolybird
Fixes: https://github.com/libguestfs/libguestfs/issues/290
Fixes: commit ed40333a23
2026-01-19 14:53:12 +00:00
Richard W.M. Jones
29162f5fe5 lib/appliance-cpu.c: Use -cpu max for RISC-V
Reported-by: https://github.com/Apache553
Fixes: https://github.com/libguestfs/libguestfs/issues/292
2026-01-19 14:53:00 +00:00
Anders Roxell
7fee08e53f tar_in: add keepdirlink option for --keep-directory-symlink
Add a new optional boolean argument 'keepdirlink' to tar_in that passes
--keep-directory-symlink to tar. This preserves existing symlinks to
directories when extracting, which is important for usrmerge systems
where /lib is a symlink to /usr/lib.

Without this option, extracting a tarball containing lib/modules/...
to / would replace the /lib symlink with a real directory, breaking
the system.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
2026-01-19 12:39:59 +00:00
Richard W.M. Jones
5da8102f5f lib/qemu.c: Don't start the guest when checking QMP properties
When checking for QMP properties, we run a qemu command and interact
with the QMP console.  However we also start the guest running (there
is no actual guest in this situation).  This occasionally causes this
line to be printed:

  libguestfs: generic_qmp_test: 3: {"timestamp": {"seconds": 1768823946, "microseconds": 898287}, "event": "GUEST_PANICKED", "data": {"action": "poweroff", "info": {"core": 0, "psw-addr": 0, "reason": "disabled-wait", "psw-mask": 562956395872256, "type": "s390"}}}\r\n

which confuses our parser.

As there is no reason to start the non-existent guest, add the -S
option which causes qemu to start up in a paused state.

For some reason this only happens on s390x but I think it could happen
on all architectures, so it may be a timing issue or something
particular about s390x firmware.
2026-01-19 12:03:59 +00:00
Richard W.M. Jones
bbbc982bf5 lib/qemu.c: Add debugging to generic_qmp_test()
This function fails sometimes on s390x, but it's hard to tell what is
going on because of insufficient debugging.
2026-01-19 10:27:24 +00:00
Richard W.M. Jones
0fe8c0492c lib/qemu.c: Turn debug messages which are really errors into error()
Commit 669eda1e24 ("lib/launch-direct.c: Simplify test for KVM, remove
qemu caching") made it so that failure of generic_qmp_test() will
cause launch to fail.  However we still used debug messages to print
the error, so unless you have debugging enabled you wouldn't see any
error message if this function fails.

Updates: commit 669eda1e24
2026-01-19 10:20:55 +00:00
Hosted Weblate
d16be4592b Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2026-01-06 12:57:49 +00:00
Andi Chandler
aeebfc34c3 Translated using Weblate (English (United Kingdom))
Currently translated at 55.7% (7384 of 13236 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/en_GB/
2026-01-06 12:57:49 +00:00
Richard W.M. Jones
d618d8eb0c Version 1.58.0. 2026-01-05 16:19:15 +00:00
Richard W.M. Jones
522c564298 docs/guestfs-release-notes-1.58.pod: Update for 1.58 release 2026-01-05 16:16:43 +00:00
Richard W.M. Jones
c7b204bce3 daemon/device-name-translation.c: Fix btrfs volume reverse translation
Devices associated with btrfs volumes are not reverse-translated
(e.g., btrfsvol:/dev/sdX to sdY).

Forward translation occurs, creating a path mismatch.  This causes
errors in subsequent btrfs commands.

Thanks: Arye Yurkovsky
2025-12-10 12:31:15 +00:00
Arye Yurkovsky
62b0e2ab64 daemon: lvm_utils: Further narrow stat failure to ENOENT
Missed the 2nd stat
2025-12-08 17:40:59 +00:00
Arye Yurkovsky
6aebf70e18 daemon: lvm_utils: Narrow stat failure to ENOENT
And remove redundant parantheses.
To only catch the failure we want to catch.
2025-12-08 17:40:59 +00:00
Arye Yurkovsky
c7228cd1ce daemon: lvm_utils: Handle stat errors
lvm returns logical volumes even if they're broken, for instance when a
physical volume is missing in their volume group.
In such cases, stat would fail to resolve the provided path.
Handle such cases by skipping such failures when finding the matching
lvm device.
2025-12-08 17:40:59 +00:00
Richard W.M. Jones
c56e6ff39b Version 1.57.7. 2025-12-04 13:16:56 +00:00
Susant Sahani
3c73a71626 tests: drop test-btrfs-misc perl file
Fixes: commit c27f3d41b1

Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-12-04 10:53:07 +00:00
Susant Sahani
1387e7f6a8 tests: nbd - convert to python
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-12-03 15:39:41 +00:00
Susant Sahani
fff03b7135 tests: selinux-label - convert to python
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-12-03 15:35:19 +00:00
Susant Sahani
1f739979bb tests: lvm-mapping - convert to python
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-12-03 15:32:56 +00:00
Susant Sahani
8f187bf97b tests: console-debug - convert to python
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-12-03 15:30:54 +00:00
Susant Sahani
bab46df1c6 tests: disk-labels - convert to python
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-12-03 15:29:26 +00:00
Susant Sahani
7f7eeb6668 tests: btrfs - subvolume-default convert to python
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-12-02 10:44:23 +00:00
Susant Sahani
c27f3d41b1 tests: btrfs - test-btrfs-misc convert to python
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-12-02 10:44:23 +00:00
Susant Sahani
7df1e9c359 tests: journal - convert to python
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-12-02 10:42:43 +00:00
Susant Sahani
817fb83742 tests: xfs - convert to python
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-12-02 10:37:05 +00:00
Susant Sahani
bd75288c5a fuse: use modern sigaction initialization for ignored signals
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-12-01 16:28:12 +00:00
Susant Sahani
19c40e5f34 tests: tmpdirs - convert to python
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-12-01 16:17:19 +00:00
Richard W.M. Jones
40fdcd0146 fish: Fix const correctness in strrchr
In C23, strchr or strrchr on a const parameter now returns a const
pointer.  We saw this error:

destpaths.c: In function ‘complete_dest_paths_generator’:
destpaths.c:165:9: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
  165 |       p = strrchr (text, '/');
      |         ^
2025-12-01 14:00:57 +00:00
Fco. Javier F. Serrador
fa7a18ed36 Translated using Weblate (Spanish)
Currently translated at 4.1% (551 of 13236 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/es/

Translated using Weblate (Spanish)

Currently translated at 62.8% (605 of 962 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/es/
2025-12-01 12:01:42 +00:00
Susant Sahani
4349548c83 lib/create: explicitly close fd and report close(2) errors
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-27 13:15:11 +00:00
Susant Sahani
192e086f66 lib/create: fix indentation in guestfs_impl_disk_create()
Convert tabs to spaces and align parameters correctly.

Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-27 11:04:10 +00:00
Susant Sahani
a3a4fc2ba9 lib/create: use bool for is_power_of_2() return type
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-27 11:03:19 +00:00
Susant Sahani
60f60e9f4e lib/create: use compound initializer for BLKDISCARD range 2025-11-27 11:02:06 +00:00
Susant Sahani
7d22402500 lib: Use bool type for allocated flag in disk creation
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-27 08:48:25 +00:00
Susant Sahani
3aaaf4f667 lib: Use compound initialization for buffer in disk creation
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-27 08:48:02 +00:00
Susant Sahani
cf6ac9aeba lib: Add automatic file descriptor cleanup using CLEANUP_CLOSE attrib
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-27 08:46:51 +00:00
Susant Sahani
40e549294e drives: Modernize guestfs_impl_add_drive_opts initialization
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-26 15:17:50 +00:00
Susant Sahani
b4d795c13d lib: Modernize guestfs_int_drive_protocol_to_string to use static array
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-26 15:17:50 +00:00
Susant Sahani
19b208777a fuse: Modernize mount_local_readdir with compound literal struct stat init
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-26 15:16:56 +00:00
Susant Sahani
257bfad817 appliance: Modernize guestfs_int_build_appliance with compound literal
No functional change.

Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-26 15:15:33 +00:00
Susant Sahani
0a8d1aefef daemon: tsk - Fix memory leak
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-24 11:15:23 +00:00
Susant Sahani
b5000cf547 daemon: send_dirent_info: Use designated compound literal for tsk_dirent
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-24 11:15:23 +00:00
Richard W.M. Jones
56da6b36d3 daemon: btrfs: Simplify snapshot code and fix invalid memory access
The existing code had a bug which you can demonstrate by doing:

  $ guestfish -N fs:btrfs:10G -m /dev/sda1 \
  btrfs-subvolume-create /sub :
  btrfs-subvolume-snapshot /sub /snap1 : \
  btrfs-subvolume-snapshot /sub /snap123 : \
  btrfs-subvolume-snapshot /sub /snap123456 : \
  btrfs-subvolume-show /sub
  ...
  libguestfs: error: appliance closed the connection unexpectedly.
  This usually means the libguestfs appliance crashed.

As the code for parsing the output and creating the comma-separated
list of snapshots was unncessarily complicated in the first place,
simplify it.  This also fixes the bug.

This also adds a regression test.

Thanks: Arye Yurkovsky
Link: https://lists.libguestfs.org/archives/list/guestfs@lists.libguestfs.org/thread/QV5VDHIH7WRUNAE54K6OEOKJMWL6M7EM/
2025-11-24 10:44:44 +00:00
Susant Sahani
6c8e3992fc fuse: Modernize mount_local_getattr with compound literal stat init
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-24 10:14:37 +00:00
Susant Sahani
b0f3d711cb lib: fuse - Replace strdup + safe_malloc with safe_strdup/safe_memdup in copy_xattr_list
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-24 10:14:37 +00:00
Susant Sahani
c3ccd2164f fuse: Modernize mount_local_statfs using compound literal statvfs init
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-24 10:14:37 +00:00
Susant Sahani
8ce7e08e1b drive-create: Modernize create_drive_file using compound literal
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-24 10:09:03 +00:00
Susant Sahani
0bd33f87ce daemon: stat_to_statns: Modernize with designated initializer
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-24 09:58:22 +00:00
Susant Sahani
0c437e52d6 daemon: bind_mount: Initialize struct bind_state with compound literal
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-24 09:58:05 +00:00
Susant Sahani
799b04fe3e daemon: Convert do_set_uuid_random to table-driven dispatch
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-24 09:49:03 +00:00
Susant Sahani
174014933a daemon: use table-driven dispatch in do_set_uuid
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-24 09:49:03 +00:00
Susant Sahani
301b9bc481 daemon: set-label: Convert to table-driven dispatch
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-24 09:47:21 +00:00
Susant Sahani
276897c4df daemon: Use modern compound literal for SIGPIPE ignore
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-21 18:58:00 +00:00
Susant Sahani
25485036a6 fuse: Modernize SIGPIPE handler using compound literal
No functional change.

Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-21 14:04:23 +00:00
Susant Sahani
4f19d68565 daemon: Use designated initializer for struct sockaddr_un
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-21 14:02:14 +00:00
Susant Sahani
3940b79041 parted: Modernize check_parttype() with table-driven mapping
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-21 13:57:26 +00:00
Richard W.M. Jones
18d9769dc3 python: Include <Python.h> first
Python is broken and requires that we include <Python.h> before all
other headers so it can make inadvisable definitions of
_POSIX_C_SOURCE and other things.  This wasn't a problem before, but a
recent change to glibc makes this necessary now.

See also a similar commit in nbdkit:
f924c3c34b

I also removed the -Wcast-align suppression as that is no longer
needed.
2025-11-20 21:00:29 +00:00
Susant Sahani
e04a450ec7 daemon: modernize program_of_csum() using table lookup
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-20 13:11:47 +00:00
Susant Sahani
3c56167615 daemon: use compound literal in send_error()
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-20 11:22:56 +00:00
Susant Sahani
4b81c6f2b1 daemon: use compound literal for reply header
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-20 11:22:56 +00:00
Susant Sahani
b983586eb3 daemon: modernize send_file_write() with compound literal
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-20 11:22:56 +00:00
Susant Sahani
bad58301fb daemon: use compound literal for zero timeval in check_for_library_cancellation
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-20 11:22:56 +00:00
Susant Sahani
60c06f3287 daemon: modernize send_file_end() with compound literal
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-20 11:22:56 +00:00
Susant Sahani
a0c9b41d35 daemon: modernize notify_progress_no_ratelimit: compound literal
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-20 10:36:57 +00:00
Susant Sahani
23257770a8 daemon: modernize pulse_mode_start with compound literals
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-20 08:47:44 +00:00
Susant Sahani
6c8763dcb5 daemon: modernize pulse_mode_cancel with compound literals
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-20 08:47:44 +00:00
Susant Sahani
0326b61157 fish: Modernize signal handler setup using compound literals
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-19 20:32:46 +00:00
Richard W.M. Jones
f2dbcdcce9 github: Use ./configure --enable-werror
We should test with compiler warnings turned into errors, to avoid
warnings being inadvertently introduced in new code.
2025-11-19 19:37:47 +00:00
Susant Sahani
9a871a1948 fish: Initialize more CLEANUP_FREE variables to NULL
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-19 15:14:39 +00:00
Susant Sahani
7e5ace69bc fish: use compound literal to reset SIGPIPE handler
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-19 15:14:24 +00:00
Richard W.M. Jones
bb4c105554 docs: Add another release note that was missed in previous commit
Fixes: commit 9d278d858f
2025-11-19 14:15:47 +00:00
Richard W.M. Jones
9d278d858f docs: Add outline release notes for libguestfs 1.58
This will be released some time in December.
2025-11-19 13:43:56 +00:00
Richard W.M. Jones
f1c9ed7556 docs/guestfs-building.pod: Require libvirt >= 11.10.0
This (actually unreleased) version of libvirt is required because of
bugs in parallel relabelling of the kernel and initrd.  For details
see:

https://github.com/libguestfs/libguestfs/issues/234
https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/AZCDGCUYCRM3TLFIWSS5P2UMCAFRDNJ4/

Thanks: Cole Robinson
2025-11-19 13:18:47 +00:00
Yuri Chornoivan
13a6674a2b Translated using Weblate (Ukrainian)
Currently translated at 100.0% (962 of 962 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/uk/
2025-11-18 22:12:33 +00:00
Susant Sahani
da0239382a fish: Use size_t instead of int for iteration over an array
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-18 16:44:25 +00:00
Susant Sahani
042d1f829a fish: Initialize variable to NULL
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-18 14:40:49 +00:00
Weblate
1ba1b2abfc Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2025-11-18 08:22:08 +00:00
Pavel Borecki
8ecfb35346 Translated using Weblate (Czech)
Currently translated at 46.3% (445 of 960 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/cs/
2025-11-18 08:22:08 +00:00
Weblate
f39cf9fcb4 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2025-11-18 08:22:08 +00:00
Ettore Atalan
8f871229f1 Translated using Weblate (German)
Currently translated at 33.9% (326 of 960 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/de/
2025-11-18 08:22:08 +00:00
Susant Sahani
f057044480 fish: Use size_t instead of int for iteration over an array
Signed-off-by: Susant Sahani <ssahani@redhat.com>
2025-11-13 16:59:48 +00:00
Richard W.M. Jones
1aff72549c tests/protocol/test-both-ends-cancel.sh: Delete this test
It tests a corner case that we don't experience in real life (although
it can happen).  Moreover the test often hangs, so we're not proving
anything except that there's a very obscure bug that we haven't fixed
and probably won't ever fix.
2025-11-06 18:35:50 +00:00
Cole Robinson
fde79f7c91 tests: test-network.sh: check guest gets expected IP
I wanted to confirm that some selinux AVCs I was seeing were not
causing runtime issues

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-11-05 14:41:49 -05:00
Cole Robinson
e209e14f4c tests: test-nbd.pl: label unix socket svirt_image_t
Part of this test uses `qemu-nbd -k SOCKPATH`, and passes
that socket to libvirt. SOCKPATH will have label user_home_t,
which svirt_t can't access, so running with selinux enforcing this
test will always fail.

Manually change the socket label to svirt_image_t which makes
selinux happy.

Note: libvirt does not relabel most (all?) externally managed socket
paths. I think this is correct, since in theory this could be a
socket shared with other processes, so its up to the user to ensure
DAC/MAC permissions are acceptable for their usecase.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-11-05 14:41:49 -05:00
Cole Robinson
50bd1fc4c2 tests: gdisk: skip if sgdisk not found on host
really what we need is sgdisk in the appliance, but for test suite
purposes this check is enough IMO

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-11-05 14:41:49 -05:00
Cole Robinson
005e701b77 tests: don't print absolute paths in test output
To match other non-libtool tests.

Before: PASS: /path/to/libguestfs.git/tests/c-api/.libs/test-config
After:  PASS: c-api/.libs/test-config

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-11-05 14:41:49 -05:00
Richard W.M. Jones
28bc6ca6b9 lib/match.c: Emit a debug message if pcre2_match returns an unexpected error
When iterating on commit 3c1554e7f2 ("lib: Add new app2_class field
for classifying applications") in early versions I was accidentally
passing NULL to match().  Unexpectedly this returned 1 (ie. matching).
This happened because we did not correctly handle other errors apart
from PCRE2_ERROR_NOMATCH from pcre2_match.

Emit a debug message when this happens, and return no match.

To test this I ran these commands, and there was no output:

  $ make && LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1 make check
  $ find -name '*.log' | xargs grep 'match.*unexpected error'
2025-11-05 15:23:12 +00:00
Richard W.M. Jones
07079ea6fc Version 1.57.6. 2025-11-04 16:20:10 +00:00
Richard W.M. Jones
a419076bd3 build: Remove config.rpath from EXTRA_DIST
Fixes: commit a497a24ecf
2025-11-04 16:19:08 +00:00
Richard W.M. Jones
476a78c75f Update common submodule
Add this generated change:

  Richard W.M. Jones (1):
      structs/structs-print.c: Update this generated file
2025-11-04 15:59:02 +00:00
Richard W.M. Jones
1db2b7837f daemon: inspect_get_windows_group_policy
Windows group policy objects (GPOs) are restrictions that can be added
by an administrator to Windows to lock down various operations.  From
our point of view the ones that matter involve restricting the ability
to inject device drivers.

Previously virt-v2v detected group policy here:

9bb2e7d470/convert/convert_windows.ml (L69)

We would like to report group policy through the libguestfs API and
tools such as virt-inspector, so move the code that is used to detect
group policy to libguestfs.  A new API is introduced that returns
whether group policy was found (only for Windows guests) during
inspection of the software registry.

Fixes: https://issues.redhat.com/browse/RHEL-125846
2025-11-04 15:56:33 +00:00
Richard W.M. Jones
355f8a5413 daemon/inspect_fs_windows.ml: Debug number of children
Just adds a useful debugging statement.
2025-11-04 15:56:33 +00:00
Richard W.M. Jones
344d96e158 lib/inspect-apps.c: Match name, display name and publisher across all regexs
For McAfee VirusScan, the name is bogus and the display name is the
actual name:

  <application>
    <name>{CE15D1B6-19B6-4D4D-8F43-CF5D2C3356FF}</name>
    <display_name>McAfee VirusScan Enterprise</display_name>
    <version>8.8.04001</version>
    <install_path>C:Program Files (x86)McAfeeVirusScan Enterprise\</install_path>
    <publisher>McAfee, Inc.</publisher>
    <url>http://www.mcafeesecurity.com/</url>
  </application>

Simplify the existing ad hoc code so we just match name, display name
and publisher (if present) against all the virus scanning strings.
2025-11-04 15:56:33 +00:00
Richard W.M. Jones
3c1554e7f2 lib: Add new app2_class field for classifying applications
Existing virt-v2v code uses some simple heuristics for detecting
Windows anti-virus software:

7520185504/convert/windows.ml

Replicate exactly this code as a new field in the struct returned by
guestfs_inspect_get_applications2.  Because of limitations with the
API, we must use one of the existing spare fields in the struct, and
it must have the same type (a string), so we are limited in the design
of this new API.  I chose to return a primary classification for the
application, with the only classification possible so far being
"antivirus" (or "" if not).  This allows the possibility of future
expansion of use of this field if we need to in future.

Fixes: https://issues.redhat.com/browse/RHEL-125846
2025-11-04 15:56:33 +00:00
Cole Robinson
04705f2aba gobject: skip test run-tests-retvalues
This is currently broken, and gobject bits are slated to be
removed entirely, so just disable this test.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-11-03 15:54:03 -05:00
Cole Robinson
967587b061 ruby: fix deprecation warnings
Convert to TypedData_Get_Struct which has been in ruby since 2009

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-11-03 15:53:50 -05:00
Cole Robinson
a497a24ecf build: remove config.rpath
It was added in d4a1c3a778 for gnulib, but since then gnulib
is no longer a submodule, and it does not seem to be required
for the build anylonger.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-10-29 09:58:28 -04:00
Cole Robinson
12acfa7de3 build: replace AM_GNU_GETTEXT with simpler LIBINTL check
This reverts "m4: Add junk required to make 'AM_GNU_GETTEXT' work"
commit b9f75ca5b8

And replaces AM_GNU_GETTEXT call with a simpler LIBINTL check
(recommended by claude).

For linux builds on glibc it doesn't appear we need anything
from autotools here, since libintl.h is always available.

For some other cases like macos I think this new minimal check
covers us in the common case.

There are definitely more obscure corner cases that gettext
m4 magic covers but I suspect none of them really matter for
any platforms libguestfs already functions on.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-10-29 09:58:28 -04:00
Cole Robinson
4d3197c3c9 tests: python: fix test820RHBZ912499.py
This tests adding a running libvirt domain to libguestfs.
This was never really a safe real-world example AFAICT because it
creates qemu overlays on top of disks that are opened writeable
by the source guest.

Nowadays qemu uses write locks to reject this type of behavior,
and the test fails.

Adjust things so the source VM opens its storage readonly, but
we are still confirming that add_libvirt_dom doesn't mess up
selinux labels.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-10-23 11:22:55 +01:00
Cole Robinson
1b791fdcd3 lib/launch-libvirt.c: avoid libvirt svirt validation error
If a user passes a custom hv, and uses add_libvirt_dom (like
in test820RHBZ912499.py) , this hits a bogus libvirt validation
check which rejects disabling svirt at both domain and disk level.

Work around it by skipping the redundant disk override when
svirt is disabled at the domain level.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-10-23 11:22:55 +01:00
Cole Robinson
acb785fede lib/launch-libvirt.c: check if g->hv symlink matches libvirt default
On fedora, ./configure will set QEMU=qemu-kvm, but libvirt
domcaps will default to qemu-system-x86_64. The former is a symlink
to the latter, but libguestfs doesn't know that, so determines
the user requested a non-default hv override and changes some
settings as a result (like disabling svirt).

Check for the symlink case and consider it a non-custom config
if realpath matches libvirt's default

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-10-23 11:22:55 +01:00
Cole Robinson
55ea21d4b3 lib/launch-libvirt.c: debug is_custom_hv result
Add debugging about is_custom_hv result.
cache the initial call so we are only hitting the debug() once.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-10-23 11:22:55 +01:00
Cole Robinson
81e9f81a6e lib/launch-libvirt.c: simplify is_custom_hv
g->hv is always set in lib/handle.c

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-10-23 11:22:55 +01:00
Cole Robinson
e051891347 lib/launch-libvirt.c: make model='selinux' disabling explicit
Using `<seclabel type='none'/>` implies `model=selinux`, so lets fill it
in to be explicit.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-10-23 11:22:55 +01:00
Cole Robinson
949679993e lib/launch-libvirt.c: Simplify root socket permissions
libvirt has DAC relabeled sockets for us for a decade, so we don't
need to do chowning here anymore

The chmod calls are still required, otherwise our created sockets
may be too permissive.

Update the comment to try and preserve the still relevant info,
though now it's a bit awkwardly placed.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-10-23 11:22:55 +01:00
Cole Robinson
62309ab40c lib/launch-libvirt.c: don't write <seclabel><imagelabel>
<imagelabel> is an output-only XML element. setting it when
defining XML does nothing

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-10-23 11:22:55 +01:00
Richard W.M. Jones
f6a63d08d4 Version 1.57.5. 2025-10-17 10:43:32 +01:00
Richard W.M. Jones
7398fdc77c lib/launch-direct.c: Remove workaround that disabled 5-level page tables
https://bugzilla.redhat.com/2082806 is a private kernel bug (sigh) for
RHEL 8, where some missing backports caused 5-level page tables to
fail when qemu emulated them.  This was fixed back in 2023, so let's
remove this workaround now.
2025-10-17 09:57:53 +01:00
Richard W.M. Jones
ac1cb3cd7c lib/qemu.c: Add -cpu max when testing for KVM via QMP
On RHEL 10.2 aarch64 (only) we see:

  $ echo '{ "execute": "qmp_capabilities" }' '{ "execute": "query-kvm" }' '{ "execute": "quit" }'  | QEMU_AUDIO_DRV=none "/usr/libexec/qemu-kvm" -display none -machine "virt,accel=kvm:hvf:tcg" -qmp stdio
  qemu-kvm: invalid accelerator hvf
  qemu-kvm: falling back to KVM
  {"QMP": {"version": {"qemu": {"micro": 0, "minor": 1, "major": 9}, "package": "qemu-kvm-9.1.0-15.el10_0.4"}, "capabilities": ["oob"]}}
  qemu-kvm: warning: CPU model cortex-a57-arm-cpu is deprecated -- use 'host' / 'max'
  qemu-kvm: kvm_init_vcpu: kvm_arch_init_vcpu failed (0): Invalid argument

Unfortunately we cannot use guestfs_int_get_cpu_model (as that
requires us to already know if KVM is supported), so we just have to
guess that -cpu max will work, at least enough for QMP to work.

Fixes: https://issues.redhat.com/browse/RHEL-121076
Reported-by: Xiang Hua Chen
2025-10-17 09:57:14 +01:00
Cole Robinson
d42227e083 generator: deprecate and remove --sm-* options
virt-customize and friends have the following options:

--sm-register
--sm-unregister
--sm-attach
--sm-remove
--sm-credentials

These run `subscription-manager` commands inside the VM, which
is often necessary to get working package install for RHEL VMs.

These were added in 2015ish. Conceptually I understand why we
might want native support in the tools: virt-customize and
virt-builder have package management knowledge, and
for some distros subscription-manager is necessary.

But this support doesn't add much convenience over calling the commands
directly with `--run-command`. And on RHEL10, subscription-manager was
reworked and complete drops the backing commands for `--sm-attach` and
`--sm-remove`.

We _could_ make this code smarter, try to detect that situation,
and not error when subscription-manager is new enough. But if
subscription-manager itself doesn't care about maintaining that kind
of compat, I'm not sure why we should care either.

Instead we decided to just rip it all out and document the
alternatives.

common module is updated to sync related changes:

  Cole Robinson (1):
        mlcustomize: deprecate and remove --sm-* options

  Richard W.M. Jones (3):
        mlstdutils: Export List.find_opt
        daemon, generator: Use power of 2 for initial size of Hashtbl.create
        mlcustomize/inject_virtio_win.ml: Use viostor.inf instead of guestor

https://issues.redhat.com/browse/RHEL-113397
https://issues.redhat.com/browse/RHEL-113398

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-10-14 18:47:30 +01:00
Cole Robinson
630628af78 tests: increase guestunmount retries for test-parallel-mount-local
test-parallel-mount-local reliably fails when my machines are
under load (like running the test suite in parallel). The
issue is /usr/libexec/gvfs-udisks2-volume-monitor fiddling with
the fuse mounts, preventing them from being unmounted.

./fuse/guestunmount defaults to 5 unmount retries with increasing
time backoff, but apparently that isn't enough. Bumping it to
use 10 retries makes things more reliable for me.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-10-14 18:26:45 +01:00
Richard W.M. Jones
e75018a534 fuse/guestunmount.c: Include <signal.h>
On macOS this fails with:

  guestunmount.c:170:5: error: call to undeclared function 'sigaction'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    170 |     sigaction (SIGINT, &sa, NULL);
        |     ^
  1 error generated.

Reported-by: Mohamed Akram
Related: https://github.com/libguestfs/libguestfs/pull/188
2025-10-07 14:06:46 +01:00
Richard W.M. Jones
63a2ed92b4 fuse: Ignore extra options parameter on macOS
macOS macfuse has an extra options parameter for the setxattr and
getxattr FUSE callbacks.  The possible options are documented below.
However the underlying libguestfs APIs don't allow us to act on these
flags, so we ignore them for now.

(from https://manp.gs/mac/2/setxattr)

  XATTR_NOFOLLOW
    do not follow symbolic links. setxattr() normally sets attributes
    on the target of path if it is a symbolic link. With this option,
    setxattr() will act on the link itself.
  XATTR_NOFOLLOW_ANY
    do not follow any symbolic links encountered during pathname
    resolution. An error is returned if a symlink is encountered
    before the last component of path.
  XATTR_CREATE
    fail if the named attribute already exists.
  XATTR_REPLACE
    fail if the named attribute does not exist. Failure to specify
    XATTR_REPLACE or XATTR_CREATE allows creation and replacement.

Reported-by: Mohamed Akram
Fixes: https://github.com/libguestfs/libguestfs/issues/180
Related: https://github.com/macfuse/macfuse/issues/1065
2025-10-07 14:06:46 +01:00
Richard W.M. Jones
84e15e784f Version 1.57.4. 2025-09-30 10:06:44 +01:00
Richard W.M. Jones
669eda1e24 lib/launch-direct.c: Simplify test for KVM, remove qemu caching
Previously we tested if KVM was available, and cached that for the
qemu binary.  I think this was actually wrong.  For example, if the
machine restarts, then the cache is still around, but KVM might be
enabled or disabled because of a new host kernel.

In any case, let's radically simplify this.

Test for KVM on each run.  Consequently we can remove all the qemu
test caching stuff as it is no longer used anywhere.

I also tightened up the code that runs the QMP query-kvm command, so
now any unexpected output will cause a runtime failure.  This command
ought to work, and if it breaks we ought to know about it and fix it.
2025-09-29 16:49:03 +01:00
Richard W.M. Jones
cfbdf9bcc7 lib/qemu.c: Remove guestfs_int_qemu_supports_device
Previously we ran 'qemu -device ?' to list devices, using the output
to test if qemu supported particular devices.  This was extensively
used in the past, but after recent commits there are no further users
of this code, so we can remove it all completely.
2025-09-29 16:49:03 +01:00
Richard W.M. Jones
4872c0cf09 lib/launch-direct.c: Assume virtio-rng
It's always a good idea to provide proper entropy to the libguestfs
appliance (eg. for any cryptographic operations).  We already assume
virtio, so we can assume virtio-rng is present.
2025-09-29 16:49:03 +01:00
Richard W.M. Jones
d8b08eac38 lib/launch-libvirt.c: Don't store libvirt_version in handle
We no longer use the libvirt version anywhere, except when reporting
the version.  Remove this from the handle.

Simplify the remaining code.  In particular:

* don't bother parsing the libvirt version, just print what
  virGetVersion gives us

* guestfs_int_version_from_libvirt is dead code, so it can be removed
2025-09-29 16:49:03 +01:00
Richard W.M. Jones
48bad58024 lib/launch-libvirt.c: Assume libvirt >= 9.0.0 and passt support
Libvirt 9.0.0 was released in January 2023, and it seems safe to
assume that if you're enabling the non-default backend, you can at
least use a new version of libvirt.

If you're using new libvirt, might as well also assume passt is
available.
2025-09-29 16:49:03 +01:00
Richard W.M. Jones
d730fc8b7c lib/launch-libvirt.c: Remove a workaround for libvirt < 3.8.0
This version of libvirt was released in 2017.
2025-09-29 16:49:03 +01:00
Richard W.M. Jones
a68f3eee15 lib/launch-libvirt.c: Add virtio-rng unconditionally
This tested for an ancient version of libvirt, but we can assume we
are always using something more recent.
2025-09-29 16:49:03 +01:00
Richard W.M. Jones
1a45db7465 lib/qemu.c: Remove qemu -help invocation
Previously we parsed qemu -help output to get the version of qemu and
to test for other features.  After prior commits, this is no longer
done, so we can remove the qemu -help invocation and associated code
completely.
2025-09-29 16:49:03 +01:00
Richard W.M. Jones
593a382840 lib: Remove guestfs_int_qemu_version
This function is now only used in one place, to print the version of
qemu in direct mode, when debugging is enabled.

Remove this function and replace with a direct command invocation
('qemu --version').  We only need to run this command when debugging
is enabled, and we copy all of the output to the debug channel.

I have made the assumption here that qemu -version does not try to
create a display device.  (The previous invocation of qemu -help
actually ran 'qemu -display none -help' indicating that this was not
always the case.)

This is actually an improvement on before, since now we get to see the
full output of 'qemu --version'.  The new output looks like:

  libguestfs: begin testing qemu features
  libguestfs: command: run: /usr/bin/qemu-kvm
  libguestfs: command: run: \ -version
  libguestfs: qemu: QEMU emulator version 10.1.0 (qemu-10.1.0-8.fc44)
  libguestfs: qemu: Copyright (c) 2003-2025 Fabrice Bellard and the QEMU Project developers
2025-09-29 16:49:03 +01:00
Richard W.M. Jones
788a1e4993 lib/launch-direct.c: Don't store qemu_version in handle
As we no longer use this field, no longer store it in the handle
struct.
2025-09-29 16:49:03 +01:00
Richard W.M. Jones
99921de6e0 lib/launch-direct.c: Move baseline to qemu 7.2.0 and assume passt support
We already effectively assume that qemu is much newer than the 1.3.0
baseline previously documented.  As one example, commit 47857751a7
("lib: direct: Remove test for qemu mandatory locking") assumes that
qemu >= 2.10.  Because passt support is desirable in general, let's
assume that qemu is at least version 7.2.0, and document it.

qemu 7.2.0 was released in December 2022, nearly 3 years ago, and RHEL
9 is currently on qemu 9.1.0.

This keeps the SLIRP fallback path in case passt isn't installed, but
we should remove that fallback in future too.
2025-09-29 16:49:03 +01:00
Richard W.M. Jones
dce5ce605d lib/launch-direct.c: Set lost_tick_policy=discard unconditionally
We already assume qemu version is must greater than 1.3.0 so we do not
need this qemu version test.
2025-09-29 16:49:03 +01:00
Richard W.M. Jones
ec47331b12 lib/launch-libvirt.c: Don't store qemu_version in handle
After previous commits, we no longer use the qemu version elsewhere
(after simply reporting it).  Remove all the code for storing the qemu
version.
2025-09-29 16:49:03 +01:00
Richard W.M. Jones
02d82a3c3a lib: Remove qemu version when testing for discard feature
We can assume much more recent qemu, so we don't need to have special
cases for qemu 1.5/1.6.
2025-09-29 16:49:03 +01:00
Richard W.M. Jones
5df7da7e81 lib/qemu.c: Remove int_qemu_supports function
This function, which grepped the qemu -help output to see if a command
line option was supported, is no longer used and can be removed.
2025-09-29 16:49:03 +01:00
Richard W.M. Jones
fc243a36bd lib/launch-direct.c: Remove unnecessary tests for ancient qemu features
We can safely assume that qemu supports -nodefaults and
-no-user-config, since these have been supported since forever.

-no-hpet was deprecated in qemu 8.0 and the option removed in early
2024, replaced with -machine hpet=off.  HPET defaults to 'on' in
upstream qemu, and to 'off' in downstream RHEL rebuilds.

Since (for libguestfs) we can assume an up to date Linux kernel is
running inside the guest, and that the kernel will do the right thing
with regards to timers, we don't need to mess with qemu defaults.  In
practice, Linux chooses kvm-clock.

Thanks: Thomas Huth, Daniel Berrange
2025-09-29 16:49:03 +01:00
Richard W.M. Jones
1f1ac69b11 lib/qemu.c: Remove qmp_schema
We used to read the QMP schema so we could see if the binary supported
qemu mandatory locking.  However after commit 47857751a7 ("lib:
direct: Remove test for qemu mandatory locking") this is dead code, so
remove it.

Updates: commit 47857751a7
2025-09-29 16:49:03 +01:00
Richard W.M. Jones
bc431d9b64 tests/regressions/rhbz790721.c: Remove this test
This was a test for a 13 year old problem to do with problems
launching libguestfs appliances in parallel.  That problem does not
affect current code.

Testing build/launch of libguestfs appliances is a valuable thing to
test.  However we start libguestfs in parallel in both the current
test suite and in higher level tools, and this test was dubious (and
breaks with recent changes).  Therefore remove the test.
2025-09-29 16:49:03 +01:00
Richard W.M. Jones
495f71affc daemon, generator: Use power of 2 for initial size of Hashtbl.create
Before 2011 it was recommended to use a prime number for the initial
size.  In 2011 the OCaml hash table was reimplemented using a hash
function based on Murmur 3.  Hashtbl.create now adjusts the initial
size to the next power of 2 (minimum 16).  So replace obsolete
'Hashtbl.create 13' with 'Hashtbl.create 16'.
2025-09-12 08:37:58 +01:00
Richard W.M. Jones
30ccb9a3e6 daemon/selinux.ml: Use setfiles -A option to reduce memory usage
In filesystems that have many millions of files, the default behaviour
of setfiles is to build a huge hash table containing every filename.
This uses up lots of memory which prevents relabelling from happening
in the reduced memory environment of the libguestfs appliance.

I added the setfiles -A option to change this default behaviour.  If
setfiles has the option then use it.

Fixes: https://issues.redhat.com/browse/RHEL-114292
Related: https://issues.redhat.com/browse/RHEL-111165
Related: https://issues.redhat.com/browse/RHEL-111505
2025-09-11 21:03:37 +01:00
Richard W.M. Jones
5f47af7f3e Version 1.57.3. 2025-09-09 19:18:04 +01:00
Richard W.M. Jones
a5b7de4a71 github: Add workflows file to EXTRA_DIST
Fixes: commit e218dd73cc
2025-09-09 19:11:31 +01:00
Richard W.M. Jones
365e7d79f7 github: Don't test on Ubuntu 24.04 twice
It turns out that ubuntu-latest is the same as 24.04, so we're just
testing on the same version twice.  Remove the duplication.

Thanks: Stephen Gallagher
Fixes: commit e218dd73cc
2025-09-09 17:34:15 +01:00
Cole Robinson
a2e7dfc73b New API: ntfs_chmod
Add an API to do the equivalent of `chmod [-r] MODE PATH` for
NTFS filesystems.

Files created on a linux ntfs-3g mount can not change permissions
directly. New files and directories are created with rough windows
equivalent of `chmod 777`. These wide open permissions can generate
security warnings on windows after virt-v2v installs bits into
`Program Files\Guestfs`.

Behind the scenes we use `ntfssecaudit(8)` from `ntfsprogs`
which is already part of the appliance. We only expose the chmod-style
feature; the rest of `ntfssecaudit` is concerned reporting and
managing fine grained windows security info which is way more than
we need.

Also note, `ntfssecaudit` needs to run on an unmounted partition
so using this is more complicated than a traditional `chmod` call.

Related: https://issues.redhat.com/browse/RHEL-104352

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-09-09 16:29:13 +01:00
Richard W.M. Jones
e218dd73cc github: Add basic github CI tests
This builds libguestfs and runs the in-tree tests, ie. the basic
'./configure && make && make check'.

We're using the "free for public repositories" plan.  We run the tests
directly on an Ubuntu VM, versions 24.04 & latest.  Also on Fedora 42,
43 in a container (running on the Ubuntu VM).

The tests are run on pushes to the master branch, and on pull
requests to the master branch.

GObject is not built, since the tests fail and anyway there are some
deep problems with the GObject bindings and they probably will be
removed.

Thanks: Stephen Gallagher, Cole Robinson
2025-09-09 13:40:49 +01:00
Richard W.M. Jones
e7b36e0eba generator: Use quoted string literals for regexps
The output of the generator is identical after this change.
2025-09-02 09:11:38 +01:00
Richard W.M. Jones
02b64d5cec generator: Use quoted string literals in many places
This change was done almost entirely automatically using the script
below.  This uses the OCaml lexer to read the source files and extract
the strings and locations.  Strings which are "candidates" (in this
case, longer than 3 lines) are replaced in the output with quoted
string literals.

Since the OCaml lexer is used, it already substitutes all escape
sequences correctly.  I diffed the output of the generator and it is
identical after this change, except for UUIDs, which change because of
how Utils.stable_uuid is implemented.

Thanks: Nicolas Ojeda Bar

$ ocamlfind opt -package unix,compiler-libs.common find_strings.ml \
                -o find_strings.opt -linkpkg
$ for f in $( git ls-files -- \*.ml ) ; do ./find_strings.opt $f ; done

open Printf

let read_whole_file path =
  let buf = Buffer.create 16384 in
  let chan = open_in path in
  let maxlen = 16384 in
  let b = Bytes.create maxlen in
  let rec loop () =
    let r = input chan b 0 maxlen in
    if r > 0 then (
      Buffer.add_substring buf (Bytes.to_string b) 0 r;
      loop ()
    )
  in
  loop ();
  close_in chan;
  Buffer.contents buf

let count_chars c str =
  let count = ref 0 in
  for i = 0 to String.length str - 1 do
    if c = String.unsafe_get str i then incr count
  done;
  !count

let subs = ref []

let consider_string str loc =
  let nr_lines = count_chars '\n' str in
  if nr_lines > 3 then
    subs := (str, loc) :: !subs

let () =
  Lexer.init ();
  let filename = Sys.argv.(1) in
  let content = read_whole_file filename in
  let lexbuf = Lexing.from_string content in
  let rec loop () =
    let token = Lexer.token lexbuf in
    (match token with
     | Parser.EOF -> ();
     | STRING (s, loc, sopt) ->
        consider_string s loc; (* sopt? *)
        loop ();
     | token ->
        loop ();
    )
  in
  loop ();

  (* The list of subs is already reversed, which is convenient
   * because we must the file substitutions in reverse order.
   *)
  let subs = !subs in
  let new_content = ref content in
  List.iter (
    fun (str, loc) ->
      let { Location.loc_start = { pos_cnum = p1 };
            loc_end = { pos_cnum = p2 } } = loc in
      let len = String.length !new_content in
      let before = String.sub !new_content 0 (p1-1) in
      let after = String.sub !new_content (p2+1) (len - p2 - 1) in
      new_content := before ^ "{|" ^ str ^ "|}" ^ after
  ) subs;

  let new_content = !new_content in

  if content <> new_content then (
    (* Update the file in place. *)
    let new_filename = filename ^ ".new"
    and backup_filename = filename ^ ".bak" in
    let chan = open_out new_filename in
    fprintf chan "%s" new_content;
    close_out chan;
    Unix.rename filename backup_filename;
    Unix.rename new_filename filename
  )
2025-09-01 17:08:52 +01:00
Richard W.M. Jones
b4a98fe13a generator/actions_core.ml: Fix typo in description of read_file 2025-09-01 16:54:43 +01:00
Richard W.M. Jones
32b911a061 daemon/inspect_fs_windows.ml: Use {|..|} string literal 2025-09-01 13:59:56 +01:00
Richard W.M. Jones
f857f39a2d daemon/selinux.ml: Simplify setfiles option testing
Updates: commit 1c0b56158a
2025-08-30 14:05:34 +01:00
Richard W.M. Jones
91ee98523e daemon/selinux.ml: Fix typo in comment
Fixes: commit d0d8e67384
2025-08-27 10:43:00 +01:00
Richard W.M. Jones
e6f93dfb9f Update common submodule
Pulls in the commits listed below.  This has no effect as all changes
are confined to the common/mlcustomize subdirectory which we do not
use or ship.

  Richard W.M. Jones (4):
      mlcustomize/SELinux_relabel.ml: Add comment
      mlcustomize/SELinux_relabel.ml: Use new guestfs_setfiles API
      mlcustomize/SELinux_relabel.ml: Relabel every mountpoint
      mlcustomize/firstboot.ml: Use quoted string literals for firstboot

  Vadim Rozenfeld (1):
      Modify the firstboot script to check the scripts execution return status
2025-08-20 10:36:48 +01:00
Richard W.M. Jones
6b19b97aa6 website: Remove very old stable branches from the index page
There's no point linking to anything other than the current stable
branch.
2025-08-15 21:37:30 +01:00
Richard W.M. Jones
82764f1b3a Version 1.57.2. 2025-08-15 10:56:08 +01:00
Richard W.M. Jones
1c00248ac1 daemon/inspect_fs_windows.ml: Ignore blank disks in drive mapping
If HKLM\System\MountedDevices references a blank disk, then when we
try to search for the actual backing device we will get an error from
parted:

  parted: /dev/sdb: parted exited with status 1: Error: /dev/sdb: unrecognised disk label: Invalid argument

Just ignore these errors instead of failing inspection.

Fixes: https://issues.redhat.com/browse/RHEL-108803
Reported-by: Ameen Barakat
Thanks: Ming Xie
2025-08-14 15:45:59 +01:00
Richard W.M. Jones
5c7e15cfae daemon/inspect_fs_windows.ml: Add debugging when we start registry analysis
Add some debugging when we begin the process of analyzing the Windows
registry of a guest.
2025-08-14 15:45:59 +01:00
Richard W.M. Jones
e18bd72c8e daemon/inspect_fs_windows.ml: Add debugging for MBR drive mappings
The function 'map_registry_disk_blob_gpt' immediately below this one
has a debugging statement.  Add the equivalent to the function
'map_registry_disk_blob_mbr'.

The output looks like:

  map_registry_disk_blob_mbr: searching for MBR disk ID 31 32 33 34
  map_registry_disk_blob_mbr: searching for MBR partition offset 00 00 00 10 00 00 00 00
2025-08-14 15:45:59 +01:00
Richard W.M. Jones
f6267d5f71 Version 1.57.1. 2025-08-13 17:06:15 +01:00
Richard W.M. Jones
1c0b56158a daemon: Deprecate guestfs_selinux_relabel, replace with guestfs_setfiles
The guestfs_selinux_relabel function was very hard to use.  In
particular it didn't just do an SELinux relabel as you might expect.
Instead you have to write a whole bunch of code around it (example[1])
to make it useful.

Another problem is that it doesn't let you pass multiple paths to the
setfiles command, but the command itself does permit that (and, as it
turns out, will require it).  There is no backwards compatible way to
extend the existing definition to allow a list parameter without
breaking API.

So deprecate guestfs_selinux_relabel.  Reimplement it as
guestfs_setfiles.  The new function is basically the same as the old
one, but allows you to pass a list of paths.  The old function calls
the new function with a single path parameter.

[1] https://github.com/libguestfs/libguestfs-common/blob/master/mlcustomize/SELinux_relabel.ml
2025-08-13 16:08:28 +01:00
Richard W.M. Jones
e4d9ee3fbc generator: Allow StringList(Pathname) parameters
This was previously not implemented.  It just requires us to call
ABS_PATH on each parameter.  ABS_PATH checks the parameter is an
absolute path.
2025-08-13 16:08:28 +01:00
Richard W.M. Jones
fd4db60cff generator: Implement StringList for OCaml functions
No existing OCaml functions have a StringList parameter, but we would
like to add one.

The original plan seems to have been to map these to 'string array'
types, but 'string list' is more natural, albeit marginally less
efficient.  The implementation here just has to convert the 'char **'
into the OCaml linked list of values.
2025-08-13 16:08:28 +01:00
Richard W.M. Jones
ed40333a23 daemon: Reimplement guestfs_selinux_relabel in OCaml
No change, just reimplement the existing C implementation in OCaml.
2025-08-13 16:08:28 +01:00
Richard W.M. Jones
c931ab3bc8 daemon: sysroot: Avoid copying the path every time we call sysroot ()
This path never changes once the daemon has started up, so we don't
need to call into C code and copy the string every time.
2025-08-13 16:08:28 +01:00
Richard W.M. Jones
1e0099671a daemon: sysroot: Avoid double-/ when creating sysroot paths in OCaml
Previously calling 'sysroot_path "/dev"' for example would return the
string "/sysroot//dev".  While this is not wrong, it confuses some
external programs (hello, setfiles), and it's not very "clean".  Be a
bit more careful to avoid doubling the '/' character in the common case.
2025-08-13 16:08:28 +01:00
Cole Robinson
06db19c56c daemon: inspect: check /etc/crypttab for /dev/mapper/*
Encrypted root fs on SUSE distros will present itself like so:

```
/dev/mapper/cr_root                         /                   btrfs   defaults                0 0
UUID=588905f9-bfa4-47b5-9fe8-893cb8ad4a0b   /var                btrfs   subvol=/@/var           0 0
... more subvols here ...
UUID=8a278363-3042-4dea-a878-592f5e1b7381   swap                btrfs   defaults                0 0
/dev/mapper/cr_root                         /.snapshots         btrfs   subvol=/@/.snapshots    0 0

cr_root  UUID=5289379a-a707-41b5-994c-c383f7ed54cc  none  x-initrd.attach
```

This breaks `-i` inspection, since libguestfs doesn't know what
/dev/mapper/cr_root is supposed to be, and nothing in the appliance
will autopopulate that path. This isn't a problem on Fedora, where
it uses UUID= instead of a /dev/mapper path.

Currently when we see /dev/mapper as a mount prefix, we only attempt
to do some LVM name mapping. This extends libguestfs to check
/etc/crypttab first. If we find an entry for the mapper path, and it
points to the encrypted luks UUID, we use that UUID to build the
associated /dev/disk/by-id/dm-uuid-CRYPT-* path, which is a symlink
to the unencrypted /dev/dm-X path

Resolves: https://issues.redhat.com/browse/RHEL-93584

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-08-12 17:55:06 +01:00
Cole Robinson
701667b6f5 docs: Fix dead ntfs-3g doc links 2025-08-04 15:49:50 +01:00
Richard W.M. Jones
217823da95 appliance/init: Add lsblk and blkid output to verbose log
This is useful for debugging.  The output looks like:

  + lsblk
  NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
  sda           8:0    0    1G  0 disk
  |-sda1        8:1    0  512M  0 part
  `-sda2        8:2    0  512M  0 part
    |-VG-Root 252:0    0   32M  0 lvm
    |-VG-LV1  252:1    0   32M  0 lvm
    |-VG-LV2  252:2    0   32M  0 lvm
    `-VG-LV3  252:3    0   64M  0 lvm
  sdb           8:16   0    4G  0 disk /
  + blkid
  /dev/mapper/VG-LV1: UUID="cc8a3437-4169-4b1c-b432-ee8adc563f6d" BLOCK_SIZE="4096" TYPE="ext2"
  /dev/sdb: UUID="30c70ddc-d00b-4620-a408-025890e59aa6" BLOCK_SIZE="4096" TYPE="ext2"
  /dev/mapper/VG-LV2: UUID="747009aa-e183-46ba-a034-0c437b15cebc" BLOCK_SIZE="1024" TYPE="ext2"
  /dev/mapper/VG-Root: LABEL="ROOT" UUID="01234567-0123-0123-0123-012345678902" BLOCK_SIZE="4096" TYPE="ext2"
  /dev/sda2: UUID="DfEjc1-wRU6-vh8U-we7U-ivEl-FRwo-rG0ZuL" TYPE="LVM2_member" PARTUUID="184cbb43-02"
  /dev/sda1: LABEL="BOOT" UUID="01234567-0123-0123-0123-012345678901" BLOCK_SIZE="4096" TYPE="ext2" PARTUUID="184cbb43-01"
  /dev/mapper/VG-LV3: UUID="f9e5dc21-9a2a-45a0-85b0-e2889607139a" BLOCK_SIZE="2048" TYPE="ext2"

Fixes: https://issues.redhat.com/browse/RHEL-106490
2025-07-30 11:06:37 +01:00
Richard W.M. Jones
f4f84a8824 daemon: Add contents of /etc/fstab to verbose log
Also some mdadm configuration files.  This is useful for debugging.

The output looks like this:

  info: /etc/fstab in /dev/VG/Root
  LABEL=BOOT /boot ext2 default 0 0$
  LABEL=ROOT / ext2 default 0 0$

Fixes: https://issues.redhat.com/browse/RHEL-106490
2025-07-30 11:01:03 +01:00
Richard W.M. Jones
c7aaa89fba lib: libvirt: Sleep before retrying virDomainDestroyFlags
This saves us going into a loop if virDomainDestroyFlags keeps
returning -EBUSY quickly, which apparenrly can happen in containers.

The equivalent 'direct' backend code sleeps for 2 seconds in this case.
2025-07-25 09:42:39 +01:00
Richard W.M. Jones
0a91731356 lib: libvirt: Debug error from virDomainDestroyFlags
It's useful to see the error returned from virDomainDestroyFlags, so
make sure this gets written to debug output.
2025-07-25 09:41:27 +01:00
Richard W.M. Jones
dc218b25f0 appliance: Ignore sit0 network device in the guest
Reported-by: Srikanth Aithal <sraithal@amd.com>
Fixed-by: Stefano Brivio <sbrivio@redhat.com>
Tested-by: Srikanth Aithal <sraithal@amd.com>
See-also: https://lists.libguestfs.org/archives/list/guestfs@lists.libguestfs.org/thread/566LAY7RNM7T7EMQQQYIQA2VK5TXETK5/
2025-06-25 11:15:31 +01:00
Richard W.M. Jones
0991b4dc21 Version 1.56.1. 2025-06-16 16:54:37 +01:00
Cole Robinson
bcf204ad68 daemon: inspect: factor out resolve_dev_mapper function
This is just code movement.

Signed-off-by: Cole Robinson <crobinso@redhat.com>

RWMJ: Renamed and moved the function for consistency with surrounding
code.
2025-06-13 09:10:30 +01:00
Richard W.M. Jones
f6fe0611a8 lib: Make libvirt ACPI feature flag conditional on x86 or Arm
On ppc64 and s390x it failed with an error like:

  unsupported configuration: machine type 'pseries-10.0' does not support ACPI

Updates: commit 7cf0ed750e
Related: https://bugzilla.redhat.com/show_bug.cgi?id=2372329
2025-06-12 08:11:56 +01:00
Richard W.M. Jones
7cf0ed750e lib: Enable ACPI for the libvirt backend
Many years ago we used to pass acpi=off on the Linux kernel command
line.  In commit db1f811b2 we stopped doing that (around 2016).
However unless you also use:

  <features>
    <acpi/>
  </features>

then it turns out that libvirt disables ACPI generation at the qemu
level.  None of this mattered until SeaBIOS 1.17 changed its
behaviour, causing ACPI to be required for virtio devices to work.

Updates: commit db1f811b29
Related: https://bugzilla.redhat.com/show_bug.cgi?id=2372329
Thanks: Gerd Hoffmann
2025-06-11 22:50:07 +01:00
Richard W.M. Jones
fba52a41b5 Version 1.56.0. 2025-06-11 14:27:19 +01:00
Richard W.M. Jones
fc25860a7e Update common submodule
Just synch with the upstream libguestfs-common master branch, before
the 1.56 release.
2025-06-11 14:26:45 +01:00
Richard W.M. Jones
dc6882e8f4 docs: Finalize release notes for 1.56 2025-06-11 14:02:36 +01:00
Richard W.M. Jones
fc5edb1255 tests: Remove test-http.py
This test has never been run.  It was originally added in
commit 36d6df671e ("tests/http: Add a test of HTTP protocol.", 2013).
However even when it was added, it was commented out.

Updates: commit 36d6df671e
2025-06-11 14:02:36 +01:00
Richard W.M. Jones
57121dbb05 docs: Remove mention of ocaml-gettext as a dependency
This package is used by guestfs-tools and virt-v2v, where tools are
written in OCaml.  However no part of libguestfs uses this.
2025-06-11 14:02:36 +01:00
Richard W.M. Jones
f2f2825f01 docs: Remove mention of python-evtx as a dependency
It may be needed by virt-log, but that is not part of libguestfs
any longer.
2025-06-11 14:02:36 +01:00
Richard W.M. Jones
32bc8bcd1d docs: Remove mention of liblzma as a dependency
This is used by virt-builder, which is not part of libguestfs.
2025-06-11 14:02:36 +01:00
Richard W.M. Jones
42dd817a82 docs: Remove mention of GPG as a dependency
This is used by virt-builder only, not part of libguestfs.
2025-06-11 14:02:36 +01:00
Richard W.M. Jones
2160c540a5 docs: Remove mention of curl as a dependency
It is used by virt-builder, but that is no longer part of libguestfs.
2025-06-11 14:02:36 +01:00
Richard W.M. Jones
b58e2624db docs: Remove mention of nbdkit as a dependency
We don't use nbdkit.  It is used by virt-v2v, but that is no longer
part of libguestfs.
2025-06-11 14:02:36 +01:00
Richard W.M. Jones
df7616fb00 docs: Remove mention of glibc as a dependency
We removed the final uses of custom printf formatters in
commit 0b3c6cc0c0 ("daemon: Remove remaining uses of custom printf %Q
and %R", 2022).

Updates: commit 0b3c6cc0c0
2025-06-11 14:02:36 +01:00
Richard W.M. Jones
db46bcb535 lib/inspect-osinfo.c: Generate new osinfo shortname for SLES >= 15
libosinfo changes the naming scheme it uses for SUSE starting with
major version 15.  Previously it used names like "sles12" (or
"sles12sp1"), "sled12" for Server and Desktop variants.  In 15+ it
uses "sle15" as there are no variants any longer (instead the
installer asks you what variant you want to install).  We're only
interested in the Server variant.  Change the name that we return to
"sle15" or "sle15sp1".

See: b0fa386699
Fixes: https://issues.redhat.com/browse/RHEL-95791
Thanks: Ming Xie, Victor Toso
Related: https://issues.redhat.com/browse/RHEL-95540
2025-06-11 11:51:18 +01:00
Richard W.M. Jones
932d662483 docs: Update release notes for 1.56
For a potential release this week.
2025-06-10 11:57:55 +01:00
Richard W.M. Jones
9171e4502f docs: Update release notes for gettext fix
Updates: commit b9f75ca5b8

Cherry picked from
guestfs-tools commit 9b7410c220f1111e6acef88efbbaee3fea4019b8
and
guestfs-tools commit bf4fef4f2b45a2016c42094f8e4fe18abc8d90e2.
2025-06-10 11:57:55 +01:00
Richard W.M. Jones
a57f6b8e2c gobject: Mark the gobject bindings as deprecated
They will be removed in libguestfs 1.58 (the next but one version).
Currently they don't actually compile.  The larger problem is that
they don't handle 64 bit quantities properly (using floats instead),
meaning that any disk size or offset above a certain size will be
improperly passed through the API, usually rounded to the nearest
53 bits.
2025-06-10 11:57:55 +01:00
Richard W.M. Jones
ba916948ab Version 1.55.14. 2025-06-03 16:33:48 +01:00
Richard W.M. Jones
8f5e4f07ba inspection: Ignore btrfs snapshots of roots
In SLES guests in particular, btrfs snapshots seem to be used to allow
rollback of changes made to the filesystem.  Dozens of snapshots may
be present.  Technically therefore these are multi-boot guests.  The
libguestfs concept of "root" of an operating system does not map well
to this, causing problems in virt-inspector and virt-v2v.

In this commit we ignore these duplicates.  The test is quite narrow
to avoid false positives: We only remove a duplicate if it is a member
of a parent device, both are btrfs, both the snapshot and parent have
a root role, and the roles are otherwise very similar.

There may be a case for reporting this information separately in
future, although it's also easy to find this out now.  For example,
when you see a btrfs root device returned by inspect_os, you could
call btrfs_subvolume_list on the root device to list the snapshots.

Fixes: https://issues.redhat.com/browse/RHEL-93109
2025-05-27 17:01:09 +01:00
Richard W.M. Jones
ebaba43221 daemon/inspect.ml: Fix comment
Back in commit 8289aa1ad6 ("New APIs for guest inspection.", 2010)
when inspection was first added, we did inspection in the library, so
it was accurate to say that inspection information was stored "in the
handle".  Much later, in commit 394d11be49 and commit 3a00c4d179
(2017) we moved inspection to the daemon, but left the comment the
same.

Fixes: commit 3a00c4d179
2025-05-27 17:01:09 +01:00
Richard W.M. Jones
b2ec671abd daemon/inspect.ml: Pipeline style when mapping and filtering filesystems
No actual change in the functionality, just make it clear that this is
a pipeline of transformations on the list of filesystems.
2025-05-27 17:01:09 +01:00
Richard W.M. Jones
7ac190ed20 daemon/listfs.ml: Add more debugging to list_filesystems
This function is used from other parts of the daemon, especially for
example with inspection.  However it was difficult to follow exactly
what filesystems it was returning because of insufficient debugging
information.
2025-05-27 17:01:09 +01:00
Richard W.M. Jones
833e5e63b3 lib/create.c: Fix string passed to printf-like function
create.c: In function 'disk_create_qcow2':
  create.c:372:5: error: format not a string literal and no format arguments [-Werror=format-security]
    372 |     debug (g, cmd_stdout);
        |     ^~~~~

Fixes: commit 606aa1d182
2025-05-22 09:48:14 +01:00
Cole Robinson
606aa1d182 lib/create.c: Capture and raise qemu-img stderr
https://issues.redhat.com/browse/RHEL-92239

After this, output looks like

   $ ./run guestfish --ro --format=qcow2 -a test.img
   libguestfs: error: qemu-img: qemu-img: /home/crobinso/src/libguestfs/tmp/libguestfsFlxnb0/overlay1.qcow2: Image is not in qcow2 format Could not open backing image. : qemu-img exited with error status 1.
   To see full error messages you may need to enable debugging.
   ...

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-05-21 16:46:16 +01:00
Cole Robinson
406588d4a0 lib: flatten extra output when external command fails
Otherwise string output looks quite awkward

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-05-21 16:46:16 +01:00
Richard W.M. Jones
3c1aebff81 Version 1.55.13. 2025-05-20 14:57:59 +01:00
Richard W.M. Jones
b98cc96129 daemon: Implement e2fsck -n flag (as FORCENO option)
Fixes: https://issues.redhat.com/browse/RHEL-92599
2025-05-20 14:40:58 +01:00
Richard W.M. Jones
b9f75ca5b8 m4: Add junk required to make 'AM_GNU_GETTEXT' work
Run gettextize, revert most of its changes, but add the m4/* files
that might be required.

This is a short term fix.  A better / longer-term fix is described by
Dan here:

https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/2AZNWQQ6CBRFZCAADVYQHU5UN5J2JT2F/
2025-05-19 16:17:32 +01:00
Richard W.M. Jones
1f74666429 Version 1.55.12. 2025-05-19 14:07:14 +01:00
Richard W.M. Jones
ea3dd97f1d New API: Replace btrfs-fsck with btrfs-scrub-full
The old btrfs-fsck API used "btrfs check" which appears to be broken
or deprecated.  The real tool you should use is "btrfs scrub".  We
have already implemented that API, but it is very awkward to use from
libguestfs.  In particular there's no existing way to run the scrub
and wait for it to finish.

Fix this by deprecating btrfs-fsck.  Implement a new API
btrfs-scrub-full which runs btrfs scrub in the foreground, waits for
it to finish, and handles errors.  It's much more like fsck tools in
other filesystems.

Thanks: Eric Sandeen
Fixes: https://issues.redhat.com/browse/RHEL-91936
2025-05-19 13:42:44 +01:00
Richard W.M. Jones
1c2b94f095 docs: Update release notes for 1.56 2025-05-13 13:14:00 +01:00
Richard W.M. Jones
f9edfc9a18 Update common submodule
This pulls in the commits below, requiring us to replace all uses of
String.is_prefix and String.is_suffix.

Mostly done with Perl like this, and carefully checked by hand
afterwards since this doesn't get everything right:

  $ perl -pi.bak -e 's/String.is_prefix ([^[:space:]\)]+) ([^[:space:]\)]+)/String.starts_with \2 \1/g' -- `git ls-files`

  Richard W.M. Jones (3):
      mlstdutils: Fix comment that still referred to the old function names
      mldrivers: Link to gettext-stub if ocaml-gettext is enabled
      mlstdutils: Rename String.is_prefix -> starts_with, is_suffix -> ends_with
2025-05-11 21:29:23 +01:00
Richard W.M. Jones
464b8915e9 ocaml-dep.sh.in: Remove mlgettext subdirectory
Libguestfs does not use ocaml-gettext at all.
2025-05-11 15:01:06 +01:00
Richard W.M. Jones
c4ebeee505 Update common submodule
Pull in these commits which require minor changes:

  Richard W.M. Jones (3):
      mlstdutils: Remove Std_utils.identity
      mlstdutils: Remove Std_utils.protect
      mlstdutils: Remove List.filter_map
2025-05-11 12:37:23 +01:00
Richard W.M. Jones
fcd169476f Update common submodule
Adds these commits:

  Richard W.M. Jones (5):
      mlstdutils: Modify List.take, List.drop to match OCaml 5.3
      mlstdutils: Rename List.dropwhile -> drop_while, takewhile -> take_while
      mlstdutils: Add List.last function
      mlstdutils: Move List module first
      mlstdutils: Add String.common_prefix, longest_common_prefix
2025-05-10 18:29:40 +01:00
Richard W.M. Jones
f6b1a7b57f appliance: Remove zfs-fuse
zfs-fuse has been unmaintained for a very long time.  In fact, the
website has gone.  This means that whatever we need for zfs (probably
some kind of license-compatible kernel module) is not going to be
provided by zfs-fuse.

See: https://bugzilla.redhat.com/show_bug.cgi?id=2214965
2025-05-09 15:52:30 +01:00
Richard W.M. Jones
61d7d16981 Version 1.55.11. 2025-05-09 15:43:11 +01:00
Richard W.M. Jones
5441d3dd0c daemon: inspect: Remove duplicate root mountpoints in /etc/fstab
A customer case was found where /etc/fstab contained multiple root
mountpoints, something like:

  LABEL=System / xfs ...
  LABEL=Boot /boot ext2 ...
  LABEL=System / xfs ...

This causes libguestfs and virt-v2v to fail.  Either (on RHEL 9) we
try to mount the second instance of / which gives an error.  Or (on
upstream kernels) we are able to mount the second instance but then
libguestfs gets confused when trying to unmount them.

In this case as the mounted devices are the same we can just delete
the duplicate.  It's also possible that there could be multiple
non-identical root mountpoints, in which case we have to pick one, and
this code arbitrarily picks the first[*] (but emits a warning).

We don't do anything for non-root mountpoints.

Update common submodule to add 'List.same' function from mlstdutils.

[*] Which one is "the first" depends on what version of ocaml-augeas
we are using.  ocaml-augeas version 0.6 Augeas.matches function
returns entries in reverse order (compared to augeas itself).  This is
fixed in version 0.7:
http://git.annexia.org/?p=ocaml-augeas.git;a=commitdiff;h=b703b92e3d26690aa6f7b822132049ce5435983e

Fixes: https://issues.redhat.com/browse/RHEL-90168
2025-05-08 21:14:23 +01:00
Richard W.M. Jones
8836c3d075 docs: Add outline release notes for libguestfs 1.56 2025-05-06 18:16:33 +01:00
Richard W.M. Jones
2424976a3c bugs-in-changelog.sh: Match at least 3 digits after RHEL- for Jira issue
We could match on 1- and 2-digit RHEL issues, thus matching strings
like "RHEL-9" and "RHEL-10".  No such Jira issues exist for us.

(cherry picked from commit 846ecb2b3840212c6f2cad6a15a6b33cd2e912bf)
2025-05-06 17:40:06 +01:00
Richard W.M. Jones
59bad26898 lib/create.c: Fix check after BLKDISCARD
We didn't correctly check for an error from the ioctl.  Thus when
using a raw block device you would often see a bogus warning in
debugging output.

Related: https://issues.redhat.com/browse/MTV-2441
2025-05-01 09:10:52 +01:00
Richard W.M. Jones
9b32056061 Fix miscellaneous spelling mistakes
$ git ls-files | xargs codespell
2025-04-29 19:05:07 +01:00
Richard W.M. Jones
ca87485eea daemon/fstrim.c: Run the fstrim command twice
In upstream kernels, for XFS, you may have to run fstrim twice for it
to be effective.

Fixes: https://issues.redhat.com/browse/RHEL-88508
Related: https://issues.redhat.com/browse/RHEL-88450
Thanks: Eric Sandeen
2025-04-28 10:07:34 +01:00
Richard W.M. Jones
7022b2a492 Version 1.55.10. 2025-04-26 11:27:19 +01:00
Richard W.M. Jones
a5fa81db03 ocaml: Link mlguestfs.cma and .cmxa with local libguestfs
Commit e11583a03a ("ocaml: Don't embed -L../lib/.libs in final
mlguestfs.cma or .cmxa") was correct in itself, but as a side effect
caused mlguestfs.cma to be linked to the system libguestfs.  If system
libguestfs was not installed, the build would fail entirely with:

  ocamlmklib -o mlguestfs \
    -ldopt '-Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1  ' \
    libguestfsocaml_a-guestfs-c.o libguestfsocaml_a-guestfs-c-actions.o libguestfsocaml_a-guestfs-c-errnos.o ../common/utils/libguestfsocaml_a-cleanups.o ../common/utils/libguestfsocaml_a-stringlists-utils.o guestfs.cmo \
     \
    -lguestfs
  /usr/bin/ld: cannot find -lguestfs: No such file or directory

Fix (from Mohamed Akram) is to add -L../lib/.libs to the -ldopt flag.
This does not embed the option in the final mlguestfs.cma file, but
seems to only use it while building the library.

Updates: commit e11583a03a
Reported-by: Mohamed Akram
Fixes: https://github.com/libguestfs/libguestfs/issues/191
2025-04-26 09:56:56 +01:00
Richard W.M. Jones
137fde9f77 ocaml: Prefer -ccopt -L... instead of -cclib
Reported-by: Mohamed Akram
Fixes: https://github.com/libguestfs/libguestfs/issues/191
2025-04-26 09:41:08 +01:00
Richard W.M. Jones
e11583a03a ocaml: Don't embed -L../lib/.libs in final mlguestfs.cma or .cmxa
$ ocamlobjinfo /usr/lib64/ocaml/guestfs/mlguestfs.cma
File /usr/lib64/ocaml/guestfs/mlguestfs.cma
Force custom: no
Extra C object files: -lmlguestfs -L../lib/.libs -lguestfs
...

(and the same in mlguestfs.cmxa).  This was caused because we run
ocamlmklib with this -L parameter so that OCaml tests and examples
will link with the local libguestfs.so (instead of the
system-installed version), but for other reasons that doesn't actually
work either.
2025-04-26 09:41:08 +01:00
Richard W.M. Jones
e127edcafc daemon/fstrim.c: Issue sync_disks after fstrim
Thanks: Eric Sandeen
2025-04-25 15:24:43 +01:00
Richard W.M. Jones
4d5fe341c7 ocaml-link.sh.in: Remove redundant use of getopt
Also allow --cclib as an alternative, and improved error reporting
when parsing the parameters to the script.

Fixes: https://github.com/libguestfs/guestfs-tools/issues/16
Reported-by: Mohamed Akram
2025-04-23 22:39:44 +01:00
Richard W.M. Jones
e49d65a5fd bash: Replace 'cp -d' command with POSIX 'cp -P'
Comment from Eric Blake:

> We don't have any hard-links in our source. GNU cp -d is the same as
> cp -P --preserve=links, but --preserve=links only matters for hard
> links, so losing it doesn't hurt our usage. I'm inclined to just go
> with cp -P unconditionally rather than needing the configure.ac
> logic for $(CP_D).

Fixes: https://github.com/libguestfs/libguestfs/issues/183
Reported-by: Mohamed Akram
Thanks: Eric Blake
2025-04-22 18:41:51 +01:00
Richard W.M. Jones
166395914f daemon: Use $(OCAMLLIB) instead of ocamlc -where
OCAMLLIB is already set to the value of ocamlc -where that was found
at configure time, so there is no need to run that command again at
build time.
2025-04-22 12:37:40 +01:00
Richard W.M. Jones
0423f2cec3 build: Only require augeas and hivex if also building the daemon
These libraries are only needed if building the daemon (so not if
using ./configure --disable-daemon).  Move the tests so we only check
for these libraries if the daemon is enabled in the build.

The daemon also requires ocaml-augeas (it uses both the augeas C
library directly and the OCaml bindings for augeas, for reasons).
However that test is already disabled if the daemon is not being
built.

Reported-by: Mohamed Akram
Fixes: commit dfa9dee775
Fixes: commit 8a723ca62e
Fixes: commit 228d49bb84
Fixes: https://github.com/libguestfs/libguestfs/issues/184
2025-04-22 12:31:15 +01:00
Richard W.M. Jones
2b2be31af0 build: Remove test for libmagic
libmagic (part of the "file" command) was required in earlier versions
of libguestfs, but this requirement was effectively removed in
commit b48da89dd6 ("daemon: Reimplement ‘file_architecture’ API in
OCaml") back in 2017.  Or to be more precise, we now use the "file"
command inside the daemon, which may or may not use libmagic but we
no longer link to the library directly.

Reported-by: Mohamed Akram
Fixes: commit b48da89dd6
Related: https://github.com/libguestfs/libguestfs/issues/184
2025-04-22 12:14:04 +01:00
Richard W.M. Jones
632937d8fb m4: Stop autoconf whinging about AC_PROG_CC_STDC being obsolete
I tried using 'autoupdate' but it failed completely to do the right
thing.
2025-04-22 11:47:58 +01:00
Richard W.M. Jones
6bf8c05961 libtool-kill-dependency_libs.sh: Ensure this only runs on *.la files
Fixes: https://github.com/libguestfs/libguestfs/issues/182
Reported-by: Mohamed Akram
2025-04-22 11:18:40 +01:00
Richard W.M. Jones
84d86f42d9 Version 1.55.9. 2025-04-16 21:48:29 +01:00
Richard W.M. Jones
e43ca19129 daemon: inspect: Resolve Ubuntu 22+ /dev/disk/by-id/dm-uuid-LVM-... in fstab
Linux + LVM supports device names like /dev/disk/by-id/dm-uuid-LVM-
followed by two concatenated UUIDs, firstly for the volume group and
secondly for the logical volume.  We can reverse those to get the
device name (/dev/VG/LV).

fstab entries look like:

  # / was on /dev/vg0/lv-0 during curtin installation
  /dev/disk/by-id/dm-uuid-LVM-OzFWT6NHkstr1hcmrWRRMDGPn9xdZj1YOOycQ533186x288FdU6UubU3OlnWJz6D / ext4 defaults 0 1
  # /usr was on /dev/vg0/lv-1 during curtin installation
  /dev/disk/by-id/dm-uuid-LVM-OzFWT6NHkstr1hcmrWRRMDGPn9xdZj1YZu53m4ZssZ8Jeb3I14RAJwIj5YlHIb9P /usr ext4 defaults 0 1

The upshot of this fix is that we are now able to correctly inspect
and run virt-v2v on Ubuntu 22+ guests with split /usr.  In particular,
we correctly map /etc/fstab entries like the above to LV device names,
which means that /usr merging now works correctly.

Reported-by: Jaroslav Spanko
Thanks: Daniel Berrange
Fixes: https://issues.redhat.com/browse/RHEL-87493
2025-04-16 21:12:49 +01:00
Richard W.M. Jones
a73f248369 daemon: Rewrite {pvs,vgs,lvs}-full APIs in OCaml
These were previously written in very convoluted C which had to deal
with parsing the crazy output of the "lvm" command.  In fact the
parsing was so complex that it was generated by the generator.  It's
easier to do this in OCaml.

These are basically legacy APIs.  They cannot be expanded and LVM
already supports many more fields.  We should replace these with APIs
for getting single named fields from LVM.
2025-04-16 21:12:49 +01:00
Richard W.M. Jones
3f9078261c Update common submodule
Pulls in these commits:

  Richard W.M. Jones (2):
      mltools: Fix memory leak in OCaml binding of libosinfo
      mlstdutils: Implement String.implode
2025-04-16 21:12:49 +01:00
Richard W.M. Jones
bcd6b3ec3a generator: Fix implementation of FUUID for OCaml functions
This was implemented wrongly.  In the XDR protocol, UUIDs are fixed
buffers of length 32.  We can just use memcpy to copy from the OCaml
string to the UUID, but we have to ensure the string length returned
by OCaml is correct (if not we just assert, it's an internal error).

(It didn't even compile before, so we know it was never used).
2025-04-16 21:12:49 +01:00
Richard W.M. Jones
7a1ffd744b daemon: inspect: Resolve Ubuntu 22+ /dev/disk/by-uuid/ in fstab
Ubuntu 22= uses /dev/disk/by-uuid/ followed by a filesystem UUID in
fstab entries.  Resolve these to mountables.

A typical fstab entry looks like this:

  # /boot was on /dev/vda2 during curtin installation
  /dev/disk/by-uuid/b4e56462-5a64-4272-b76d-f5e58bd8f128 /boot ext4 defaults 0 1

The comment is generated by the installer and appears in the fstab.
This entry would be translated to /dev/sda2.
2025-04-16 21:12:49 +01:00
rwmjones
6fb268997e Merge pull request #186 from rwmjones/2025-fdevice
Implement struct FDevice type in the generator and use it for `pvs_full`
2025-04-16 21:11:57 +01:00
Richard W.M. Jones
5a16d1120f generator: Use new FDevice type for the pvs-full pv_name field
Remove the code which did explicit reverse device name translation,
and use the generator's code instead.
2025-04-16 12:27:07 +01:00
Richard W.M. Jones
0ff73a42c7 generator: Implement struct FDevice type
This acts just like FString except that we do reverse device name
translation on it.  The only use is in the 'pvs-full' API where we
will use it (in a subsequent commit) to reverse translate the pv_name
field (a device name) before returning it from the daemon.

Compare this to the 'pvs' API which also returns a list of device
names, but using the generator's 'RStructList (RDevice,...)'  return
type, where RDevice is similarly reverse translated.

Note in the library-side bindings, because the name has already been
translated in the daemon, we just treat it exactly the same as
FString.  The vast majority of this patch is this mechanical change.
2025-04-16 12:27:07 +01:00
Richard W.M. Jones
2d1e894130 daemon: inspect: Add some debugging of /usr merging 2025-04-16 10:28:41 +01:00
rwmjones
7d561ee6f0 Merge pull request #178 from crobinso/osinfo-doc-tweak
common: update submodule
2025-04-09 21:33:28 +01:00
Cole Robinson
abdec091c4 common: update submodule
Cole Robinson (2):
          mltools: decouple and simplify osinfo device support checks
          mlcustomize: disable `--inject-virtio-win osinfo`

    Richard W.M. Jones (3):
          mltools: Fix de-oUnit-ized tests
          mltools: Unreference various objects
          Revert "mltools: Unreference various objects"

And update customize docs to match

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-04-09 16:12:44 -04:00
rwmjones
945d4e0663 Merge pull request #177 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2025-04-04 11:10:10 +01:00
Weblate
8cad86d63c Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2025-04-04 12:06:26 +02:00
Ricky Tigg
1b27b7ed1a Translated using Weblate (Finnish)
Currently translated at 9.7% (94 of 960 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/fi/
2025-04-04 12:06:26 +02:00
Richard W.M. Jones
8f375320c3 Version 1.55.8. 2025-04-03 19:31:16 +01:00
Richard W.M. Jones
f523684a0b lib/launch-libvirt.c: Remove fallback <emulator> for Arm
This "hopefully temporary hack" was actually added 12 years ago in
commit 37e1e0da5a ("arm: launch: libvirt: Force <emulator>.")
2025-03-31 18:19:00 +01:00
rwmjones
3951893849 Merge pull request #176 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2025-03-31 15:16:09 +01:00
Ettore Atalan
4a8acbf87d Translated using Weblate (German)
Currently translated at 33.8% (325 of 960 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/de/
2025-03-31 13:53:35 +02:00
Richard W.M. Jones
85c8445e1e build: Remove use of oUnit
This added no value over just running ordinary tests.  This also
removes a complicated OCaml dependency.
2025-03-22 12:41:39 +00:00
rwmjones
2f0fa0fd23 Merge pull request #175 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2025-03-22 11:47:37 +00:00
Weblate
693465e057 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2025-03-22 11:53:58 +01:00
Ricky Tigg
4d6387da3f Translated using Weblate (Finnish)
Currently translated at 1.1% (152 of 13341 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/fi/
2025-03-22 11:53:58 +01:00
Richard W.M. Jones
090ea7656e build: Remove detection of lex and yacc
These are not required by libguestfs.  They were used by virt-builder,
but that tool has now been moved to a separate project
(guestfs-tools).

Fixes: commit 733d2182b6
2025-03-22 10:51:21 +00:00
Richard W.M. Jones
f7083e588e build: Add heading about basic build environment
(cherry picked from
virt-v2v commit c523c63a4916b5620666341dad54bf5d999c1fbe)
2025-03-16 13:58:56 +00:00
Richard W.M. Jones
21ae4c37b7 build: Only use ANSI colour sequences if stdout is a terminal
https://stackoverflow.com/a/10022396
2025-03-11 21:04:20 +00:00
Richard W.M. Jones
3a8947323b build: Colourize features
Print yes features in green and no features in red.
2025-03-11 15:31:17 +00:00
Richard W.M. Jones
cf75c12a9e build: Embolden headings in configure output
If using a colour terminal, display headings in bold.
2025-03-11 15:30:18 +00:00
Richard W.M. Jones
471d328b9e build: Add 'feature' and 'print' to display configured features.
Borrow 'feature' and 'print' functions from nbdkit and use these to
display configured features in a simpler and more consistent way.
2025-03-11 15:28:50 +00:00
Richard W.M. Jones
e765e31f3a Version 1.55.7. 2025-03-11 14:44:16 +00:00
Richard W.M. Jones
4176b2043f daemon: Fix loongarch64 detection on RHEL 9
$ rpm -q file
file-5.39-16.el9.x86_64
$ file ./test-data/binaries/bin-loongarch64-dynamic
./test-data/binaries/bin-loongarch64-dynamic: ELF 64-bit LSB pie executable, *unknown arch 0x102* version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-loongarch-lp64d.so.1, BuildID[sha1]=7622a1a70bf6e697851ac3790557e1ca686459b5, for GNU/Linux 5.19.0, stripped

Updates: commit 729d6d55ea
2025-03-11 13:40:14 +00:00
Richard W.M. Jones
bf4a6c2f85 build: Remove unused website/download/builder/ directory 2025-03-11 11:00:29 +00:00
Richard W.M. Jones
31fa712aa0 lib: Print kernel utsname in debug output
Useful for debugging problems caused by the host kernel.  In
particular we were looking at a problem with passt creating a user
namespace but didn't know what exact kernel was being used.
2025-03-10 18:56:39 +00:00
rwmjones
01909c51ff Merge pull request #174 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2025-03-05 12:34:03 +00:00
Yuri Chornoivan
58a72cb2aa Translated using Weblate (Ukrainian)
Currently translated at 100.0% (960 of 960 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/uk/
2025-03-05 07:38:45 +01:00
rwmjones
4401d81654 Merge pull request #173 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2025-03-04 08:39:52 +00:00
Weblate
8876360d97 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2025-03-03 22:09:20 +01:00
Krascovict Petrov
f63f88a5bf Translated using Weblate (Portuguese (Brazil))
Currently translated at 0.1% (24 of 13337 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/pt_BR/
2025-03-03 22:09:20 +01:00
denisecheng
0c70675aae support TencentOS
Signed-off-by: denisecheng <denisecheng@tencent.com>
Fixes: https://github.com/libguestfs/libguestfs/pull/172
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
2025-03-03 14:22:37 +00:00
Jacob Reger
f81444ccad libguestfs: Rust binding build error and warning fixes
Internal error type did not implement the necessary traits to be
treated as a proper Rust error. This would cause ergonomic issues
with manual error handling and with error handling crates like
anyhow. Implement the Display and Error trait for internal Error
type. This also fixes the build warnings.

Signed-off-by: Jacob Reger <regerjacob@gmail.com>
2025-02-25 22:00:12 +00:00
Jacob Reger
d7d5264ce8 libguestfs: Rust binding build error and warning fixes
Fixed break in Rust bindings where callback registering expected a
*const i8, but were provided with a *const c_char. Changed to be both
*const c_char in alignment with the libguestfs documentation.

Signed-off-by: Jacob Reger <regerjacob@gmail.com>
2025-02-25 21:53:36 +00:00
Richard W.M. Jones
95ed25aba6 Version 1.55.6. 2025-02-19 16:42:52 +00:00
Richard W.M. Jones
47ac4871b2 daemon: New command_out and sh_out APIs
These APIs allow you to capture output from guest commands that
generate more output than the protocol limit allows.

Thanks: Nijin Ashok
Fixes: https://issues.redhat.com/browse/RHEL-80159
2025-02-19 12:01:10 +00:00
Richard W.M. Jones
8d61b04dd6 ruby: Make sure all object files are cleaned up
There were several, large *.o files left over after 'make clean':

$ ls ruby/ext/guestfs/
actions-0.c  actions-2.c  actions-4.c  actions-6.c    handle.c
actions-0.o  actions-2.o  actions-4.o  actions-6.o    handle.o
actions-1.c  actions-3.c  actions-5.c  actions.h      module.c
actions-1.o  actions-3.o  actions-5.o  extconf.rb.in  module.o
2025-02-18 11:57:07 +00:00
Richard W.M. Jones
a1ecc0006c tests/syslinux/test-syslinux.pl: Send skip messages to stderr
Otherwise they won't appear in test-suite.log.
2025-02-18 11:55:07 +00:00
Richard W.M. Jones
3749443464 tests/syslinux/test-syslinux.pl: Fix disk image location
tests/Makefile.am assumes the test image is located in
tests/syslinux/, but we actually created it in tests/.  Fix the
location, and also ensure the test will clean it up after running
successfully.
2025-02-18 11:53:41 +00:00
Richard W.M. Jones
14e78e9ac8 Version 1.55.5. 2025-02-18 10:10:03 +00:00
Richard W.M. Jones
72cfaff5c5 Update copyright dates for 2025
Automated using this command:

perl -pi.bak -e 's/(20[012][0-9])-20[12][01234]/$1-2025/g' `git ls-files`
2025-02-16 17:00:46 +00:00
Richard W.M. Jones
1b7d905d43 logo: Restore year banner in logo
Fixes: commit e2c7bddf10
2025-02-16 16:57:43 +00:00
Richard W.M. Jones
32644856e7 build: Remove test-functions.sh which was moved and renamed
Fixes: commit b5fbc7e617
2025-02-16 15:39:31 +00:00
Richard W.M. Jones
b5fbc7e617 tests: Replace $TEST_FUNCTIONS
Replace strange $TEST_FUNCTIONS variable/expansion thing with
something more like what we use in nbdkit, a simple tests/functions.sh
script that gets sourced into each test script.

Update the common submodule to get:

  commit 8137d47d0e654065391151eb275e3b64f230f6f5
  Author: Richard W.M. Jones <rjones@redhat.com>
  Date:   Thu Feb 13 11:13:55 2025 +0000

    mlcustomize, mltools: Replace $TEST_FUNCTIONS

    TEST_FUNCTIONS is being removed from libguestfs and guestfs-tools (it
    was removed from virt-v2v a while back).  Make the same adjustment in
    the common submodule.

(and some other commits which are not relevant to libguestfs)
2025-02-13 11:15:34 +00:00
Daniel Gomez
82e2dea96a appliance: add support for sfdisk on Debian
Fixes virt-builder error:

virt-builder: error: libguestfs error: inspect_os: execvp: sfdisk: No
such file or directory

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
2025-02-06 08:26:20 +00:00
Daniel Gomez
91fab3f498 appliance: add dhcpcd support on Debian
Debian has replaced the deprecated isc-dhcp-client (dhclient) with
dhcpcd-base (dhcpcd) as the default DHCP client [1]. This causes network
issues in virt-builder since isc-dhcp-client is no longer installed
by default.

Add support for dhcpcd (dhcpcd-base package) in Debian.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1041066

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
2025-02-06 08:26:20 +00:00
Richard W.M. Jones
2c6fb596b7 Version 1.55.4. 2025-02-05 13:33:39 +00:00
Richard W.M. Jones
6ba8449927 appliance/init: Fix /usr/sbin symlinks in Fedora 42+
Since Fedora 42 merged /usr/sbin and /usr/bin, /usr/sbin is usually
populated with symbolic links to binaries in /usr/bin.  These are
created by a complicated script in filesystem.spec that we don't run.
Emulate sort of what that script is doing instead.

This is a hack that we can eventually remove, hopefully.

See-also: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/PCU2WWLEGLGIOY4TCCBIHLYS6ZCZ4GSS/
2025-02-05 13:09:26 +00:00
rwmjones
0dee44bd36 Merge pull request #169 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2025-02-03 08:04:00 +00:00
Ricky Tigg
9cfa081a91 Translated using Weblate (Finnish)
Currently translated at 9.7% (94 of 960 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/fi/
2025-01-11 08:16:02 +01:00
rwmjones
16a407fc44 Merge pull request #168 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2025-01-09 09:13:25 +00:00
Weblate
19e2caf587 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2025-01-09 09:38:45 +01:00
Ricky Tigg
1d7897aa63 Translated using Weblate (Finnish)
Currently translated at 1.4% (231 of 16048 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/fi/
2025-01-09 09:38:44 +01:00
Richard W.M. Jones
ef64bb6a88 Version 1.55.3. 2025-01-08 17:43:19 +00:00
Richard W.M. Jones
2ec93578be po-docs/libguestfs-docs.pot: Rebuild this file from scratch
Reported-by: Ricky Tigg
Fixes: https://github.com/libguestfs/libguestfs/issues/167
2025-01-08 12:12:07 +00:00
Richard W.M. Jones
b875c5e6b0 dist: Force po-docs/libguestfs-docs.pot to be rebuilt
It's not ideal to delete this file, but it seems like the only way to
force make to really rebuild it.
2025-01-08 12:10:33 +00:00
Richard W.M. Jones
48d3264573 po-docs: Use po4a-updatepo
As far as I can tell using po4a-gettextize was wrong here.  The right
subtool for combining multiple documents into a .pot is po4a-updatepo,
so use that one instead.
2025-01-08 12:04:26 +00:00
Richard W.M. Jones
1aa883c50d docs/guestfs-release-notes-1.34.pod: Clarify confusing language
Reported-by: Ricky Tigg
Fixes: https://github.com/libguestfs/libguestfs/issues/167
2025-01-08 11:44:39 +00:00
rwmjones
0e982277fa Merge pull request #164 from rwmjones/issue162
daemon: Translate file 5.46 "Intel i386" to "i386"
2025-01-06 09:39:06 +00:00
Richard W.M. Jones
ed21af3b0a daemon: Translate file 5.46 "Intel i386" to "i386"
Fixes: https://github.com/libguestfs/libguestfs/issues/162
Reported-by: Toolybird
2025-01-02 16:13:35 +00:00
rwmjones
7008e2e350 Merge pull request #161 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2025-01-02 15:43:25 +00:00
Ricky Tigg
1e52c5b253 Translated using Weblate (Finnish)
Currently translated at 1.3% (211 of 16048 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/fi/
2024-12-20 16:48:24 +01:00
Weblate
db0ad1f25d Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2024-12-20 10:39:13 +01:00
Ricky Tigg
0ffef7e655 Translated using Weblate (Finnish)
Currently translated at 1.2% (199 of 16048 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/fi/

Translated using Weblate (Finnish)

Currently translated at 9.6% (93 of 960 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/fi/
2024-12-20 10:39:13 +01:00
Richard W.M. Jones
996dd8774f build: Move baseline OCaml to 4.08
OCaml 4.08.0 was released on 2019-06-14, over 5 years ago.  By
requiring a slightly later OCaml version, we can drop more
compatibility code which was only used by older versions.

Consistent with qemu & libvirt, this drops support for compiling
upstream libguestfs on RHEL 8 (ocaml-4.07.0-4.el8.x86_64).

Qemu policy:
https://www.qemu.org/docs/master/about/build-platforms.html

Libvirt policy:
https://libvirt.org/platforms.html

Update the common submodule, pulling in:

  Richard W.M. Jones (4):
      qemuopts: Add ability to add raw, unquoted output to qemu scripts
      qemuopts: Fix missing break statement
      mlstdutils: Remove Option module
      Remove test for caml_alloc_initialized_string
2024-11-21 14:30:44 +00:00
Richard W.M. Jones
453de98bda Version 1.55.2. 2024-11-18 14:39:38 +00:00
Richard W.M. Jones
4ebec324fe docs: recipes: Update xpath command
Link: https://lists.libguestfs.org/archives/list/guestfs@lists.libguestfs.org/thread/SOWJHHHJXDFAKSCCLXCNUE5X7W22VUEQ/
Reported-by: Emmanuel Kasper
2024-11-18 14:05:06 +00:00
Richard W.M. Jones
73186b154c generator: Remove common/mlv2v/uefi.ml{,i} files
Stop generating these files.  They are currently only used by virt-v2v
-o qemu mode, and there are better ways to locate the UEFI files
there.

Update the common submodule to bring in:

  Richard W.M. Jones (5):
      mlcustomize: Add heuristic support for Windows Server 2025
      mlcustomize/customize_run.ml: Move 'in' to new line
      mlstdutils/guestfs_config: Define host_os
      mlcustomize, mltools: Check guest OS is compatible before allowing --run
      Remove mlv2v/ subdirectory
2024-11-15 11:43:50 +00:00
rwmjones
8af8e15b44 Merge pull request #159 from twouters/bugfix/dhcpcd_resolvconf_symlink
Fix dhcpcd failing on systemd-resolved stub
2024-11-14 09:01:05 +00:00
Thomas Wouters
84d1cd0707 Fix dhcpcd failing on systemd-resolved stub
dhcpcd fails to update /etc/resolv.conf if is a dangling symlink, so remove it
if it is.

This happens on Arch Linux when systemd-resolved is enabled by symlinking
/etc/resolv.conf to /run/systemd/resolve/stub-resolv.conf. The symlink is copied
into the supermin appliance, but the target file is not and this causes dhcpcd to
fail when it tries to update /etc/resolv.conf.

The handling of /etc/resolv.conf could be improved in dhcpcd but it's not their
job to decide when to remove the symlink. We do have the authority to decide
whether or not to use systemd-resolved or resolvconf in the appliance, so we can
remove it.
2024-11-13 14:09:59 +01:00
rwmjones
7d551fa7db Merge pull request #158 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2024-11-06 12:22:03 +00:00
Weblate
2ce7b00e1e Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2024-11-06 13:16:54 +01:00
Léane GRASSER
ea86636649 Translated using Weblate (French)
Currently translated at 63.8% (614 of 961 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/fr/
2024-11-06 13:16:54 +01:00
Richard W.M. Jones
a47e2cf6a8 website: Fix link to latest development version
Fixes: commit 0edaea8f91
2024-10-22 17:44:06 +01:00
Richard W.M. Jones
7932b92379 Version 1.55.1. 2024-10-22 17:38:11 +01:00
Richard W.M. Jones
9255abee02 build: Remove Jansson dependency
After previous changes, this library is no longer used.  We have
switched to json-c, for better compatibility with libvirt.

(cherry picked from
guestfs-tools commit e6dcf7e3a7e9170978e57ce6df1b34f92fac5ae3)
2024-10-22 16:44:53 +01:00
Richard W.M. Jones
9e3c1f44ca lib/qemu.c: Replace jansson with json-c 2024-10-22 16:44:53 +01:00
Richard W.M. Jones
47857751a7 lib: direct: Remove test for qemu mandatory locking
We tested for QEMU >= 2.10 support for mandatory locking.  I believe
this is for all practical purposes always enabled now (and qemu 2.10
is ancient history) so simply assume it's true always.
2024-10-22 16:23:07 +01:00
Richard W.M. Jones
13e3222f34 lib/info.c: Replace jansson with json-c 2024-10-22 16:03:16 +01:00
Richard W.M. Jones
8e34b37bcd common: Update common submodule
Although we don't use JSON_parser in libguestfs, update the submodule
just to get rid of another Jansson dependency:

  Richard W.M. Jones (1):
      mltools: Replace jansson with json-c
2024-10-22 15:35:14 +01:00
Richard W.M. Jones
5ea1e899e0 daemon/ldm.c: Replace jansson with json-c 2024-10-22 11:02:38 +01:00
Richard W.M. Jones
53872a0a1a build: Add new dependency on json-c
This will eventually replace Jansson for all JSON parsing.  However
this commit simply introduces the new dependency in the configure
script and documents it.

I chose json-c 0.14 as the baseline since that is the version in RHEL 9.
Probably earlier versions would work.
2024-10-22 11:01:25 +01:00
Richard W.M. Jones
798e3e59b2 appliance: Refactor the TAR_COMMAND macro
No change, just make it easier to understand.

Updates: commit 53632b4b82
2024-10-22 09:15:56 +01:00
Richard W.M. Jones
53632b4b82 appliance: Use stable owner, group and mtime in appliance tarballs
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2320025
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
2024-10-21 12:14:03 +01:00
Richard W.M. Jones
e37768d889 build: Assume __attribute__((cleanup)) always works
All recent compilers support this (except MS compilers which we don't
care about).  Assume it is supported.  We test it in ./configure and
hard fail if it doesn't work.

We still define HAVE_ATTRIBUTE_CLEANUP but you can now assume it is
always defined and don't have to check it.
2024-10-18 21:55:21 +01:00
Richard W.M. Jones
0f489f8eec lib/inspect-osinfo.c: Add Windows Server 2025 osinfo
The guest was found to have these inspection fields:

    type: windows
    distro: windows
    product_name: Windows Server 2025 Standard
    product_variant: Server
    version: 10.0
    arch: x86_64
    hostname: WIN-84V4KKQ30SM
    build ID: 26080
    windows_systemroot: /Windows
    windows_software_hive: /Windows/System32/config/SOFTWARE
    windows_system_hive: /Windows/System32/config/SYSTEM
    windows_current_control_set: ControlSet001

Reported-by: Ming Xie
Fixes: https://issues.redhat.com/browse/RHEL-62935
2024-10-17 08:59:49 +01:00
Richard W.M. Jones
c25ff1a802 tests/gdisk/test-expand-gpt.pl: Implement SKIP rule for this test
Reported-by: David Runge
Related: https://github.com/libguestfs/libguestfs/issues/155
2024-10-14 10:43:08 +01:00
Richard W.M. Jones
0edaea8f91 website: Add links for 1.54 and 1.55 download locations 2024-10-08 14:53:38 +01:00
Richard W.M. Jones
3fb6ebb342 Version 1.54.0. 2024-10-08 14:37:12 +01:00
Richard W.M. Jones
e4691f66b7 docs: Finalize release notes for libguestfs 1.54 2024-10-08 13:41:43 +01:00
Richard W.M. Jones
715b5def13 Version 1.53.7. 2024-10-03 13:09:36 +01:00
Richard W.M. Jones
49f118e9da docs: Create outline release notes for 1.54 2024-10-02 16:13:52 +01:00
Richard W.M. Jones
e97c6f5933 bugs-in-changelog.sh: List Jira IDs and github issues in output 2024-10-02 16:02:43 +01:00
Richard W.M. Jones
a6639afb74 po-docs: Add mlcustomize POD to po-docs/podfiles
Add these two files from the common/ submodule:

common/mlcustomize/v2v-customize-options.pod
common/mlcustomize/v2v-customize-synopsis.pod

Updates: commit fe1ce09242
2024-10-02 15:48:41 +01:00
Richard W.M. Jones
e55eac12d4 docs: Update libguestfs email address in a couple more places
Reported-by: Julian Euler
2024-09-12 12:45:54 +01:00
Wang Guoquan
1d8924c343 libguestfs: Support openEuler
openEuler is simliar to CentOS, but the ID is not lower-case string,
as below:

    NAME="openEuler"
    VERSION="24.03 (LTS)"
    ID="openEuler"
    VERSION_ID="24.03"
    PRETTY_NAME="openEuler 24.03 (LTS)"
    ANSI_COLOR="0;31"

Signed-off-by: Wang Guoquan <wangguoquan03@foxmail.com>
2024-09-10 11:33:20 +01:00
rwmjones
82ffc1e66e Merge pull request #153 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2024-09-04 13:35:14 +01:00
Yuri Chornoivan
f2e5dbf0ef Translated using Weblate (Ukrainian)
Currently translated at 100.0% (961 of 961 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/uk/
2024-09-04 12:38:36 +02:00
rwmjones
faec06b6fb Merge pull request #152 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2024-09-02 15:00:44 +01:00
Weblate
6ed520dc00 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2024-09-02 15:40:40 +02:00
Andi Chandler
82b538abae Translated using Weblate (English (United Kingdom))
Currently translated at 54.0% (8671 of 16047 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/en_GB/

Translated using Weblate (English (United Kingdom))

Currently translated at 3.4% (33 of 970 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/en_GB/
2024-09-02 15:40:39 +02:00
Richard W.M. Jones
fe1ce09242 generator: Don't include virt-customize --inject* options in virt-v2v
Virt-v2v already includes facilities for injecting QEMU guest agent
etc.  We shouldn't add the virt-customize options for this.

Update common submodule to include:

Richard W.M. Jones (2):
      mlcustomize: Move virt-customize modules to mlcustomize/
      mlcustomize: Update generated options for virt-v2v
2024-08-20 21:22:30 +01:00
Richard W.M. Jones
ba6b5c71d4 Version 1.53.6. 2024-08-16 15:29:34 +01:00
Richard W.M. Jones
b607f97329 Update common submodule
Pull in some fixes from the common submodule.  None of these should be
applicable to libguestfs, they apply only to guestfs-tools and
virt-v2v.

Richard W.M. Jones (13):
      mlcustomize: Add Inject_virtio_win.inject_blnsvr implementation
      mlcustomize: firstboot: Use Linux path for Powershell script path
      mlcustomize: firstboot: Use powershell.exe instead of path
      mlcustomize: firstboot: Use Powershell -NoProfile flag
      mlcustomize: Revert delay installation of qemu-ga MSI
      mldrivers/linux_kernels.ml: Prefix general information with ^info:
      mlcustomize: Use Start-Process -Wait to run qemu-ga installer
      mlcustomize: Add Firstboot.firstboot_dir function
      mlcustomize: Place powershell scripts into <firstboot_dir>\Temp
      mlcustomize: Inject qemu-ga & blnsvr into <firstboot_dir>/Temp
      mlcustomize: Write qemu-ga log file name to log.txt
      mlcustomize: Add some comments to firstboot batch file
      mlcustomize: Reboot Windows between each firstboot script
2024-08-16 14:58:16 +01:00
Richard W.M. Jones
b2d682a473 appliance/init: Don't set impossible "noop" disk scheduler
Since RHEL 7.4, the noop scheduler is no longer a thing.  Trying to
set it results in the error:

  + echo noop
  /init: line 108: echo: write error: Invalid argument

The current recommendation (https://access.redhat.com/solutions/5427)
is to use mq-deadline, but that's also the default so we don't have to
do anything.

A bigger reason to remove these lines is that kernel 6.11.0 has
introduced a hang where -- rarely -- the ext4 filesystem hangs if you
try to change the scheduler while handing a page fault, even if you're
setting a scheduler that doesn't exist.  I couldn't get much detail
except for a couple of stack traces from different VMs:

  crash> set 234
      PID: 234
  COMMAND: "modprobe"
     TASK: ffff9f5ec3a22f40  [THREAD_INFO: ffff9f5ec3a22f40]
      CPU: 0
    STATE: TASK_UNINTERRUPTIBLE
  crash> bt
  PID: 234      TASK: ffff9f5ec3a22f40  CPU: 0    COMMAND: "modprobe"
   #0 [ffffb21e002e7840] __schedule at ffffffffa718f6d0
   #1 [ffffb21e002e78f8] schedule at ffffffffa7190a27
   #2 [ffffb21e002e7908] __bio_queue_enter at ffffffffa67e121c
   #3 [ffffb21e002e7968] blk_mq_submit_bio at ffffffffa67f358c
   #4 [ffffb21e002e79f0] __submit_bio at ffffffffa67e1e3c
   #5 [ffffb21e002e7a58] submit_bio_noacct_nocheck at ffffffffa67e2326
   #6 [ffffb21e002e7ac0] ext4_mpage_readpages at ffffffffa65ceafc
   #7 [ffffb21e002e7be0] read_pages at ffffffffa6381d17
   #8 [ffffb21e002e7c40] page_cache_ra_unbounded at ffffffffa6381ff5
   #9 [ffffb21e002e7ca8] filemap_fault at ffffffffa63761b5
  #10 [ffffb21e002e7d48] __do_fault at ffffffffa63d1892
  #11 [ffffb21e002e7d70] do_fault at ffffffffa63d2425
  #12 [ffffb21e002e7da0] __handle_mm_fault at ffffffffa63d8c6b
  #13 [ffffb21e002e7e88] handle_mm_fault at ffffffffa63d95c2
  #14 [ffffb21e002e7ec8] do_user_addr_fault at ffffffffa60b34ea
  #15 [ffffb21e002e7f28] exc_page_fault at ffffffffa7186e4e
  #16 [ffffb21e002e7f50] asm_exc_page_fault at ffffffffa72012a6
      RIP: 000055d16159f8d8  RSP: 00007ffdd4c1f340  RFLAGS: 00010206
      RAX: 00000000000bec82  RBX: 00007ff2fd00dc82  RCX: 000055d1615b492a
      RDX: 00007ffdd4c216b0  RSI: 00000000200bec82  RDI: 000055d185725960
      RBP: 00007ffdd4c1f5a0   R8: 0000000000000000   R9: 0000000000000000
      R10: 0000000000000000  R11: 0000000000000202  R12: 00000000200bec82
      R13: 000055d185725960  R14: 00007ffdd4c216b0  R15: 000055d1615b9708
      ORIG_RAX: ffffffffffffffff  CS: 0033  SS: 002b

  crash> set 230
      PID: 230
  COMMAND: "modprobe"
     TASK: ffff98ce03ca3040  [THREAD_INFO: ffff98ce03ca3040]
      CPU: 0
    STATE: TASK_UNINTERRUPTIBLE
  crash> bt
  PID: 230      TASK: ffff98ce03ca3040  CPU: 0    COMMAND: "modprobe"
   #0 [ffffaf9940307840] __schedule at ffffffff9618f6d0
   #1 [ffffaf99403078f8] schedule at ffffffff96190a27
   #2 [ffffaf9940307908] __bio_queue_enter at ffffffff957e121c
   #3 [ffffaf9940307968] blk_mq_submit_bio at ffffffff957f358c
   #4 [ffffaf99403079f0] __submit_bio at ffffffff957e1e3c
   #5 [ffffaf9940307a58] submit_bio_noacct_nocheck at ffffffff957e2326
   #6 [ffffaf9940307ac0] ext4_mpage_readpages at ffffffff955ceafc
   #7 [ffffaf9940307be0] read_pages at ffffffff95381d1a
   #8 [ffffaf9940307c40] page_cache_ra_unbounded at ffffffff95381ff5
   #9 [ffffaf9940307ca8] filemap_fault at ffffffff953761b5
  #10 [ffffaf9940307d48] __do_fault at ffffffff953d1895
  #11 [ffffaf9940307d70] do_fault at ffffffff953d2425
  #12 [ffffaf9940307da0] __handle_mm_fault at ffffffff953d8c6b
  #13 [ffffaf9940307e88] handle_mm_fault at ffffffff953d95c2
  #14 [ffffaf9940307ec8] do_user_addr_fault at ffffffff950b34ea
  #15 [ffffaf9940307f28] exc_page_fault at ffffffff96186e4e
  #16 [ffffaf9940307f50] asm_exc_page_fault at ffffffff962012a6
      RIP: 0000556b7a7468d8  RSP: 00007ffde2ffb560  RFLAGS: 00000206
      RAX: 00000000000bec82  RBX: 00007f5331a0dc82  RCX: 0000556b7a75b92a
      RDX: 00007ffde2ffd8d0  RSI: 00000000200bec82  RDI: 0000556ba8edf960
      RBP: 00007ffde2ffb7c0   R8: 0000000000000000   R9: 0000000000000000
      R10: 0000000000000000  R11: 0000000000000202  R12: 00000000200bec82
      R13: 0000556ba8edf960  R14: 00007ffde2ffd8d0  R15: 0000556b7a760708
      ORIG_RAX: ffffffffffffffff  CS: 0033  SS: 002b

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2303267
2024-08-16 08:32:40 +01:00
Antonio Caggiano
bbc58ed8fb ocaml: INSTALL_OCAMLLIB Makefile parameter
Add INSTALL_OCAMLLIB parameter for allowing ocaml install to a user
defined path. If not defined, fallback to `ocamlc -where`.

Signed-off-by: Antonio Caggiano <quic_acaggian@quicinc.com>
2024-08-13 14:00:42 +01:00
Antonio Caggiano
e17d794d11 configure: Use -map in script flags on darwin.
-M is not a valid flag for MacOS ld.

Signed-off-by: Antonio Caggiano <quic_acaggian@quicinc.com>
2024-08-12 14:05:01 +01:00
Antonio Caggiano
ad3ccf42ab qemu: Add HVF to the accelerators list.
This speeds up greatly QEMU when running on MacOS.

Signed-off-by: Antonio Caggiano <quic_acaggian@quicinc.com>
2024-08-12 11:28:50 +01:00
Antonio Caggiano
0bae769f78 lib: Fix environ on MacOS
On macOS, environ is not declared. Use the workaround suggested here:
https://www.gnu.org/software/gnulib/manual/html_node/environ.html

Signed-off-by: Antonio Caggiano <quic_acaggian@quicinc.com>
2024-08-12 11:24:07 +01:00
Antonio Caggiano
b25bb8b8ba build: Link libvirt-is-version with libgnu
This fixes building the tool on MacOS.

Signed-off-by: Antonio Caggiano <quic_acaggian@quicinc.com>
2024-08-12 11:24:07 +01:00
Richard W.M. Jones
3d2061b83c daemon/inspect_fs.ml: Sort lists of distros
No change, just tidying up the lists.
2024-07-11 13:12:41 +01:00
grass-lu
a429ab3319 Kylin is centos derivative
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2024-07-11 13:12:24 +01:00
Richard W.M. Jones
e631d1a78c Version 1.53.5. 2024-07-08 16:27:32 +01:00
Richard W.M. Jones
6bf22df62a generator/actions_core.ml: Fix version field for new APIs
Fixes: commit 1816651f3c
2024-07-08 16:27:13 +01:00
Richard W.M. Jones
e616c8f286 inspection: Resolve PARTUUID= and PARTLABEL= in /etc/fstab
Fixes: https://issues.redhat.com/browse/RHEL-46596
2024-07-08 14:44:01 +01:00
Richard W.M. Jones
1816651f3c New APIs: findfs_partuuid and findfs_partlabel
These search for partitions by UUID or label (name).  They only work
for GPT.
2024-07-08 14:44:01 +01:00
Richard W.M. Jones
4c5c0782af daemon/findfs.ml: Fix whitespace 2024-07-08 14:37:06 +01:00
Richard W.M. Jones
5b8b7baefd Version 1.53.4. 2024-06-28 12:50:43 +01:00
Richard W.M. Jones
be06cb048b perl: Pass @CFLAGS@ through extra_linker_flags
The documentation for Module::Build is completely opaque on how you're
supposed to pass @CFLAGS@ correctly.  However I noticed that we were
not passing -g through when generating Guestfs.so:

gcc -lpthread -shared -Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now '-specs=/usr/lib/rpm/redhat/redhat-hardened-ld' '-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1' '-Wl,--build-id=sha1' -L/usr/local/lib -fstack-protector-strong -lperl -o blib/arch/auto/Sys/Guestfs/Guestfs.so lib/Sys/Guestfs.o -L../lib/.libs -lguestfs

This debuginfo was not always being generated correctly.  (For some
reason it still manages to be generated in Fedora and RHEL 9, but not
in RHEL 10, this part is still unclear to me.)

Anyway it seems we ought to pass at least -g to the linker, and we
might as well pass the full set of @CFLAGS@, hence this change.
2024-06-28 12:37:11 +01:00
Richard W.M. Jones
24c1f7b03a daemon: Fix parsing in part_get_gpt_attributes
The actual output of sfdisk --part-attrs is bizarre and doesn't match
the documentation.  After looking at the source from util-linux, fix
the parsing to match what sfdisk produces.

Reported-by: Yongkui Guo
Fixes: commit c6c266a85d
Fixes: https://issues.redhat.com/browse/RHEL-35998
2024-06-28 09:42:20 +01:00
Richard W.M. Jones
882ef4d93a generator/daemon: Don't truncate 64 bit results from OCaml functions
Commit d5b6f1df5f ("daemon: Allow parts of the daemon and APIs to be
written in OCaml.", 2017) contained a bug where in any OCaml function
that returns int64_t, the result was truncated to an int.  This
particularly affected part_get_gpt_attributes as that returns large 64
bit numbers, but probably affects other functions too, undetected.

Fixes: commit d5b6f1df5f
2024-06-28 09:39:59 +01:00
Richard W.M. Jones
06eff058a3 Version 1.53.3. 2024-06-27 16:40:55 +01:00
Richard W.M. Jones
8b3e8a9056 Remove tftp drive support
This was only theoretically supported, via curl.  It's unlikely that
it really worked as it was never tested.

If needed it's better to use nbdkit-curl-plugin instead (this applies
to http and ftp as well).
2024-06-27 16:27:06 +01:00
Richard W.M. Jones
b1db7847ee Remove sheepdog support
This was discontinued in qemu quite a long time ago.
2024-06-27 16:22:52 +01:00
Richard W.M. Jones
c080449511 Remove gluster support
Development on gluster has stopped upstream, see:

https://marc.info/?l=fedora-devel-list&m=171934833215726&w=2
2024-06-27 16:13:09 +01:00
Jürgen Hötzel
43946911c7 rust: Handle null pointer when creating slice
Starting with Rust 1.78 null assertions in the standard library are
now checked when compiling in test/debug mode.

Fixes: https://github.com/libguestfs/libguestfs/issues/145
2024-06-20 13:27:51 +01:00
rwmjones
893c05fc40 Merge pull request #147 from jonte/feature/cryptsetup_cipher
daemon: cryptsetup_open: Add --cipher
2024-06-20 10:43:47 +01:00
Jonatan Pålsson
465be22d9b daemon: cryptsetup_open: Add --cipher
This allows passing the --cipher argument to cryptsetup as an optional
parameter.
2024-06-20 07:42:55 +02:00
Richard W.M. Jones
12da1de0a8 lib: libvirt: Stop recommending LIBGUESTFS_BACKEND=direct
After many, many years, although libvirt does still often fail to
work, it's generally more secure to stick with libvirt than to try
running qemu directly.  The main issue here is that people have
cargo-culted LIBGUESTFS_BACKEND=direct everywhere (even when it's not
necessary).
2024-05-22 11:22:31 +01:00
Richard W.M. Jones
219845d5d0 generator/customize.ml: Add virt-customize --inject-blnsvr operation
Also updates the common submodule with the generated files.
2024-05-16 12:48:51 +01:00
Olaf Hering
4ef645778a appliance: only wait for resolv.conf update if dhcpcd succeeded
In case network was requested, but the host lacks both dhclient and
dhcpcd, skip the loop which waits for a resolv.conf update.

This reduces boot time by 10 seconds.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2024-05-15 17:11:02 +01:00
Richard W.M. Jones
27deba4074 gobject: Add libguestfs-gobject-1.0.deps to main EXTRA_DIST line
Move this outside the 'if HAVE_INTROSPECTION' conditional so that we
get this object in the tarball even if using ./configure --disable-gobject
2024-05-13 14:52:21 +01:00
Richard W.M. Jones
c7fe9fd917 tests: btrfs: Remove another test that used qgroup 0/*
This was failing with recent Linux:

  libguestfs: error: btrfs_subvolume_snapshot: /dir/test3: /dir/test6: ERROR: cannot snapshot '/sysroot/dir/test3': Invalid argument

I tried to change the test to use 1/1000 instead, but that fails with
a different error which I don't understand at all.

As we're not meant to be testing btrfs here, only that libguestfs can
translate between the guestfs API and btrfs commands and we know it
can do that, I simply deleted the sub-test entirely.
2024-05-13 14:35:36 +01:00
Richard W.M. Jones
ff3dd6f91f Version 1.53.2. 2024-05-10 16:47:17 +01:00
Richard W.M. Jones
c6c266a85d daemon: Reimplement partition GPT functions using sfdisk
sfdisk can now do everything with GPT that sgdisk was needed for
before.  In particular we are able to reimplement the following
functions using sfdisk:

- part_set_disk_guid   (replace with sfdisk --disk-id)
- part_get_disk_guid
- part_set_disk_guid_random
- part_set_gpt_attributes           (sfdisk --part-attrs)
- part_get_gpt_attributes
- part_set_gpt_guid                 (sfdisk --part-uuid)
- part_get_gpt_guid
- part_set_gpt_type                 (sfdisk --part-type)
- part_get_gpt_type

This allows us to drop the requirement for gdisk in many cases.

There is only one API remaining which requires gdisk, part_expand_gpt,
which we do not use in our tools.  In a prior commit I already moved
this solitary function to a new source file (daemon/gdisk.c).

Fixes: https://issues.redhat.com/browse/RHEL-35998
2024-05-10 16:25:13 +01:00
Richard W.M. Jones
a25f419802 daemon: Add an OCaml binding for get_random_uuid function 2024-05-10 16:07:20 +01:00
Richard W.M. Jones
53eb96099a generator: Allow String(GUID) parameter in daemon OCaml bindings 2024-05-10 15:37:08 +01:00
Richard W.M. Jones
d5c6e15180 daemon: Move gdisk function to a new file
After subsequent commits, this will be the only remaining use of
gdisk, so put it in its own file now.
2024-05-10 15:36:03 +01:00
Richard W.M. Jones
2811e42b43 daemon: part_get_gpt_type: Remove unhelpful MBR fallback behaviour
This was an accident of the parted implementation, and wasn't really
used anywhere.  Remove it.
2024-05-10 15:29:07 +01:00
Richard W.M. Jones
857615d6d2 daemon/parted: Assume sfdisk --part-type exists
This "new" parameter was added in 2014:

  commit 8eab3194ce1737a167812d5e84d83b0dfc253fac
  Author: Karel Zak <kzak@redhat.com>
  Date:   Mon Sep 15 12:37:52 2014 +0200

    sfdisk: add --parttype

    The patch also makes --{id,change-id,print-id} deprecated in favour
    of --parttype. The original --id is too generic option name and the
    --print-id and --change-id are unnecessary and inconsistent with
    another sfdisk options (e.g. we don't have --change-bootable)

Also remove an extraneous / incorrect comment about parted.  As
history has played out, sfdisk proves to be the better tool and parted
is a PITA.
2024-05-10 15:29:07 +01:00
rwmjones
8c438e7442 Merge pull request #142 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2024-05-09 10:49:23 +01:00
Weblate
2234390442 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2024-05-09 11:36:38 +02:00
zhanchun li
2a611c3a33 Translated using Weblate (Chinese (Simplified) (zh_CN))
Currently translated at 2.9% (29 of 970 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/zh_CN/
2024-05-09 11:36:37 +02:00
Richard W.M. Jones
c2f1825574 Version 1.53.1. 2024-04-25 13:43:28 +01:00
Richard W.M. Jones
e0ffe31e96 gobject: tests: Don't erase error messages 2024-04-25 13:17:02 +01:00
Richard W.M. Jones
665e0dde81 test-data/binaries: Regenerate LoongArch files with stripping
These were regenerated by Dan Berrange from a known good Debian
container image.  In addition they are stripped.  The commands were:

 $ podman run -it registry.gitlab.com/qemu-project/qemu/qemu/debian-loongarch-cross
 # echo 'int main(){}' > bin.c
 # loongarch64-unknown-linux-gnu-gcc bin.c -o bin-loongarch64
 # loongarch64-unknown-linux-gnu-strip --strip-all bin-loongarch64
 # echo '' > lib.c
 # loongarch64-unknown-linux-gnu-gcc -shared lib.c -o lib-loongarch64.so
 # loongarch64-unknown-linux-gnu-strip --strip-all lib-loongarch64.so

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2024-04-25 13:00:55 +01:00
Richard W.M. Jones
574a87f889 test-data/binaries: Remove +x attribute
These binaries are not meant to be run, they are purely data files
used for testing.  Remove the +x attribute to prevent accidentally
running them.

However to avoid breaking the phony guests, we need to chmod +x the
files when we upload them into those guests.
2024-04-25 13:00:22 +01:00
Richard W.M. Jones
87b4d19f85 po-docs: Make sure guestmount.1 depends on includes
guestmount.1 depends on translated files blocksize-option.pod,
key-option.pod & keys-from-stdin-option.pod (via __INCLUDE__
directives).  If these are not yet translated by the time we try to
generate guestmount.1 then it will fail with:

podwrapper.pl: key-option.pod: cannot find input file on path at /builddir/build/BUILD/libguestfs-1.50.1/podwrapper.pl line 672.

This happens especially in parallel builds.  Fix this by writing the
guestmount.1 rule explicitly, with the correct dependencies.
2024-04-24 22:17:33 +01:00
Richard W.M. Jones
7968de46f1 Update common submodule
In particular pick this:

  commit 93a7f3af5c23ece6a8e092827ed5928a8973fd3c
  Author: Richard W.M. Jones <rjones@redhat.com>
  Date:   Wed Apr 24 12:08:01 2024 +0100

    options: Allow nbd+unix:// URIs
2024-04-24 12:23:34 +01:00
Richard W.M. Jones
6ba64125d9 website: Update link for forthcoming 1.53 development branch 2024-04-13 10:41:55 +01:00
Richard W.M. Jones
d755070346 po-docs: Run po4a-translate and sed commands separately
I noticed that 1-byte translated POD files were being generated in the
output directory (po-docs/ja/).  This seems to have happened because
po4a-translate was generating an error, but because we were
immediately pipeing the output into sed the error was suppressed.

By running them as two separate commands this cannot happen.

Fixes: commit bd896d68c0
2024-04-04 09:38:28 +01:00
Richard W.M. Jones
d829778529 po-docs: Rename guestfs-release-notes-historical to guestfs-release-notes
This was missed from earlier commit 25ddaefb03 ("docs: Recreate
guestfs-release-notes(1) page").

Fixes: commit 25ddaefb03
2024-04-04 09:28:43 +01:00
Richard W.M. Jones
1d760b0d8f python: Fix exception name in example
Fixes: https://github.com/libguestfs/libguestfs/issues/138
2024-03-12 14:08:24 +00:00
Richard W.M. Jones
37d2379be2 daemon: Fix file architecture translation for LoongArch
Fixes: commit 729d6d55ea
2024-03-07 16:50:29 +00:00
Richard W.M. Jones
7211aac047 tests: btrfs: Don't try to create qgroup 0/_
This used to work in kernel <= 6.7 but has been forbidden in later
kernels:
0c309d66da

Reported-by: David Runge
Thanks: Jan Alexander Steffens
Fixes: https://github.com/libguestfs/libguestfs/issues/136
2024-03-07 16:50:29 +00:00
Richard W.M. Jones
c8cefa6f0f daemon: parted: Print field we are extracting in error message 2024-03-07 14:17:45 +00:00
liuxiang
729d6d55ea Add support for LoongArch.
Signed-off-by: liuxiang <liuxiang@loongson.cn>
2024-02-21 10:50:07 +00:00
Bella Zhang
72f99817c7 Add detection support for Circle Linux 2024-02-06 12:22:00 +00:00
Alexey Shabalin
f878f72430 daemon: Add gost checksum command support
gostsum - generates or checks GOST R34.11-94 message digests
gost12sum - generates or checks GOST R34.11-2012 message digests

A reference implementation https://github.com/gost-engine/engine

Fixes: https://github.com/libguestfs/libguestfs/pull/132
Signed-off-by: Alexey Shabalin <shaba@altlinux.org>

[RWMJ: Added documentation, and added gostsum package to
the appliance]
2024-01-25 13:28:22 +00:00
Richard W.M. Jones
e9a728bb22 generator/customize.ml: Split --chown parameter on ':' character
The previous code split it on ',' which was completely wrong.
(It reveals the lack of testing however).

Fixes: commit c08032ebe2
Reported-by: Yongkui Guo
2024-01-19 13:24:37 +00:00
Richard W.M. Jones
836a977c16 Version 1.52.0. 2024-01-04 17:31:41 +00:00
Richard W.M. Jones
9bfd3f9b25 docs: Fix AUTHORS to account for changes to common submodule
Updates: commit 68fcf11456
2024-01-04 16:51:01 +00:00
Richard W.M. Jones
08f6140398 docs: Further small revisions to libguestfs 1.52 release notes
Updates: commit 68fcf11456
2024-01-04 16:44:17 +00:00
Richard W.M. Jones
7b7f326767 docs: Fix description of new LVM mapper in --key feature
Fixes: commit 68fcf11456
2024-01-04 16:36:13 +00:00
Richard W.M. Jones
68fcf11456 docs: Add outline release notes for libguestfs 1.52 2024-01-04 13:47:34 +00:00
Richard W.M. Jones
4e4801a2c3 bugs-in-changelog.sh: Use grep -E instead of egrep
New version of coreutils egrep whinges.
2024-01-04 13:43:15 +00:00
Richard W.M. Jones
465db54be3 Version 1.51.10. 2023-12-19 15:30:45 +00:00
Juergen Hoetzel
102e503648 daemon/btrfs: Use new syntax for balance command
Support for the obsolete short syntax 'btrfs balance /path' was
removed in btrfs-progs 6.6.
2023-12-14 16:53:50 +00:00
Richard W.M. Jones
40f43cc8ea tests: Test guestfish --key all:... selector 2023-12-14 09:15:08 +00:00
Richard W.M. Jones
7fd41b5a02 Update common submodule
The list of patches is below.  The one which matters for guestfish is
addition of --key all:... selector.

Andrey Drobyshev (1):
      mldrivers: look for bootloader config in /boot/grub/grub.cfg in case of UEFI

Richard W.M. Jones (5):
      mlxml: Include <libxml/parser.h> for xmlReadMemory
      options/keys.c: Rewrite confusing match statement
      options: Rewrite --key documentation fragment
      options: Allow --key all:SELECTOR to be used to match any device
      mltools/libosinfo-c.c: Fix off-by-one error

Fixes: https://issues.redhat.com/browse/RHEL-19367
2023-12-14 09:04:56 +00:00
Richard W.M. Jones
e93fd7e8ac ocaml: Nullify custom block before releasing runtime lock
Avoids a potential, though if possible then very rare, double free
path.

Suggested-by: Guillaume Munch-Maccagnoni
See: https://github.com/ocaml/ocaml/issues/12820
2023-12-14 08:35:46 +00:00
Richard W.M. Jones
61418535ad ocaml: Use Gc.finalise instead of a C finalizer
Since OCaml 5.1.1, changes to custom blocks caused C finalizers that
call caml_enter_blocking_section to stop working (if they ever did
before).  They are relatively inflexible compared to registering an
OCaml finalizer (Gc.finalise) to call Guestfs.close, so use that
instead.

Suggested-by: Guillaume Munch-Maccagnoni
See: https://github.com/ocaml/ocaml/issues/12820
See: db48794fa8
2023-12-13 22:55:03 +00:00
Richard W.M. Jones
e5788357cf Version 1.51.9. 2023-12-09 11:47:32 +00:00
Richard W.M. Jones
02c39dc5e8 lib: Include <libxml/parser.h> for xmlReadMemory
Since libxml2 2.12.1 including this header is required to have this
function declared.
2023-11-27 14:12:37 +00:00
rwmjones
0ea7684d28 Merge pull request #130 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2023-11-27 10:13:26 +00:00
Temuri Doghonadze
5ff1aca486 Translated using Weblate (Georgian)
Currently translated at 16.3% (159 of 970 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/ka/
2023-11-26 22:01:17 +01:00
rwmjones
5efea5ee8d Merge pull request #129 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2023-11-24 19:15:39 +00:00
Weblate
62a4df0989 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2023-11-24 20:05:56 +01:00
Richard W.M. Jones
1dd3f3540e Version 1.51.8. 2023-11-16 13:27:49 +00:00
Richard W.M. Jones
b2f3994de2 New mailing list archives 2023-11-16 10:52:11 +00:00
Richard W.M. Jones
0b8b1e4b2d New mailing list email address 2023-11-16 10:38:59 +00:00
Richard W.M. Jones
f53859723e appliance: Wait for /etc/resolv.conf to be populated
Work around this issue with dhcpcd:
https://github.com/NetworkConfiguration/dhcpcd/issues/258

Fixes: commit 0e37e5feea
2023-11-16 10:17:35 +00:00
Richard W.M. Jones
0e37e5feea appliance: Allow dhcpcd to be used on Red Hat platforms
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2247057
Fixes: https://github.com/libguestfs/libguestfs/issues/121
2023-10-30 14:31:26 +00:00
Richard W.M. Jones
b5f7b0ec18 generator: Add new virt-customize --tar-in operation
Using 'virt-customize --tar-in some.tar:/dir -a disk.img' will unpack
'some.tar' into '/dir' in the guest.  Note that this will not work for
compressed tar files as written since the underlying guestfs_tar_in
function requires the compression type to be set explicitly and
defaults to no compression (it does not auto-detect or default to
compression).
2023-10-26 21:16:41 +01:00
Richard W.M. Jones
297db5cccc generator: Sort virt-customize options into alphabetical order 2023-10-26 21:07:57 +01:00
Richard W.M. Jones
f8cbd71400 daemon: Find -lcamlstr{nat,byt} and -lunix{nat,byt}, and require -lzstd
OCaml 5.1 changes the names of these libraries for some reason.

Also in OCaml 5.1, if using those libraries you must link with -lzstd.
Since zstd was already described as "required" (although we only used
it in the appliance), there is no official change to the requirements,
but I have added a configure time check for the library.

Thanks: Jerry James <loganjerry@gmail.com>
2023-10-06 11:23:52 +01:00
Richard W.M. Jones
62b1deb125 Version 1.51.7. 2023-09-21 15:35:01 +01:00
Richard W.M. Jones
ecf361d723 ruby: Get rid of old Test::Unit compatibility
See this commit in hivex:
6dbbc474d3
2023-09-21 15:21:18 +01:00
Richard W.M. Jones
d25a48e2dd ruby: Replace MiniTest with Minitest
See this commit in hivex:
fbcff7fbd8
2023-09-21 15:16:51 +01:00
Richard W.M. Jones
c95d8c4cf6 daemon: Omit 'file -S' option on older distros that lack support
OpenSUSE LEAP 15 lacks support for this option, so test for it before
using it.

See also:
https://listman.redhat.com/archives/libguestfs/2023-September/032613.html

Reported-by: Olaf Hering
Fixes: commit 23986d3c4f
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2023-09-21 15:09:14 +01:00
cunshunxia
188c5f7d93 support OpencloudOS
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Fixes: https://github.com/libguestfs/libguestfs/pull/125
2023-09-19 11:02:23 +01:00
rwmjones
f76c871adb Merge pull request #123 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2023-08-07 13:05:44 +01:00
Weblate
a2f62ed3f4 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2023-08-05 13:21:14 +02:00
Emilio Herrera
84ea870f07 Translated using Weblate (Spanish)
Currently translated at 2.1% (343 of 16046 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/es/
2023-08-05 13:21:13 +02:00
Richard W.M. Jones
cc33c8185e Version 1.51.6. 2023-07-20 18:51:57 +01:00
Richard W.M. Jones
32cb5b45cf daemon: lvm: Do reverse device name translation on pvs_full device fields
Intermittent test failures in virt-filesystems showed that when using
the pvs_full API, the pv_name field in the returned list of structures
was not being reverse translated.  As a result internal partition
names could appear in the output of virt-filesystems.

See: https://listman.redhat.com/archives/libguestfs/2023-July/032058.html
2023-07-20 11:15:26 +01:00
Richard W.M. Jones
c08032ebe2 generator: customize: Add new StringTriplet for use by --chown
The just added --chown option previously used StringPair, splitting
the argument as ‘UID.GID:FILENAME’.  However this will not work if we
ever extend this with the ability to use user or group names, since
they may contain dot (but not colon).  Add a new StringTriplet type
and split the argument string three ways.  The new option becomes:

  virt-customize ... --chown UID:GID:FILENAME

Include the following commit from the common submodule:

  commit e70d89a58dae068be2e19c7c21558707261af96a
  Author: Richard W.M. Jones <rjones@redhat.com>
  Date:   Sat Jul 15 16:42:06 2023 +0100

    customize: Update generated files for --chown with StringTriplet

Updates: commit d8e48bff21
2023-07-15 16:45:57 +01:00
Richard W.M. Jones
e4b4787df1 Version 1.51.5. 2023-07-14 20:59:29 +01:00
Laszlo Ersek
02bbc9daa7 lib/launch-direct: support networking with passt
On QEMU 7.2.0+, if "passt" is available, ask QEMU for passt ("stream")
rather than SLIRP ("user") networking.

For this, we need to run passt ourselves. Given that passt daemonizes by
default, start it with our traditional function guestfs_int_cmd_run(). Ask
passt to save its PID file, because in case something goes wrong before
we're completely sure the appliance (i.e. QEMU) is up and running, we'll
need to kill passt, the *grandchild*, ourselves.

Pass "--one-off" to passt (same as libvirt). This way, once we have proof
that QEMU has connected to passt (because the appliance shows signs of
life), we need not clean up passt ourselves -- once QEMU exits, passt will
see an EOF on the unix domain socket, and exit as well.

Passt is way more flexible than SLIRP, and passt normally intends to
imitate the host environment in the guest as much as possible. This means
that, when switching from SLIRP to passt, the guest would see changes to
the following:

- guest IP address,

- guest subnet mask,

- host (= gateway) IP address,

- host (= gateway) MAC address.

Extract the SLIRP defaults into the new macros NETWORK_GW_IP and
NETWORK_GW_MAC, and pass them explicitly to passt. In particular,
"tests/rsync/test-rsync.sh" fails without setting the host address
(NETWORK_GW_IP) properly.

(These artifacts can be verified in the appliance with "virt-rescue
--network", by running "ip addr", "ip route", and "ip neighbor" at the
virt-rescue prompt. There are four scenarios: two libguest backends, times
passt being installed or not installed.)

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2184967
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20230714132213.96616-8-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2023-07-14 17:57:20 +02:00
Laszlo Ersek
bd3e033e08 lib: introduce guestfs_int_make_pid_path()
Introduce a small function for creating pathnames for PID files.

guestfs_int_make_pid_path() is something of an amalgamation of
guestfs_int_make_temp_path() [1] and guestfs_int_create_socketname() [2]:

- it creates a pathname under sockdir, like [2],

- it uses the handle's unique counter, like [1],

- it takes a name like both [1] and [2], but the name is not size-limited
  like in [2], plus we hardcode the suffix from [1] as ".pid".

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2184967
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Message-Id: <20230714132213.96616-7-lersek@redhat.com>
2023-07-14 17:57:19 +02:00
Laszlo Ersek
0b2ad40a09 lib: move guestfs_int_create_socketname() from "launch.c" to "tmpdirs.c"
Consider the following inverted call tree (effectively a dependency tree
-- callees are at the top and near the left margin):

  lazy_make_tmpdir()                  [lib/tmpdirs.c]
    guestfs_int_lazy_make_tmpdir()    [lib/tmpdirs.c]
      guestfs_int_make_temp_path()    [lib/tmpdirs.c]
    guestfs_int_lazy_make_sockdir()   [lib/tmpdirs.c]
      guestfs_int_create_socketname() [lib/launch.c]

lazy_make_tmpdir() is our common workhorse / helper function that
centralizes the mkdtemp() function call.

guestfs_int_lazy_make_tmpdir() and guestfs_int_lazy_make_sockdir() are the
next level functions, both calling lazy_make_tmpdir(), just feeding it
different dirname generator functions, and different "is_runtime_dir"
qualifications. These functions create temp dirs for various, more
specific, purposes (see the manual and "lib/guestfs-internal.h" for more
details).

On a yet higher level are guestfs_int_make_temp_path() and
guestfs_int_create_socketname() -- they serve for creating *entries* in
those specific temp directories.

The discrepancy here is that, although all the other functions live in
"lib/tmpdirs.c", guestfs_int_create_socketname() is defined in
"lib/launch.c". That makes for a confusing code reading; move the function
to "lib/tmpdirs.c", just below its sibling function
guestfs_int_make_temp_path().

While at it, correct the leading comment on
guestfs_int_create_socketname() -- the socket pathname is created in the
socket directory, not in the temporary directory.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2184967
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Message-Id: <20230714132213.96616-6-lersek@redhat.com>
2023-07-14 17:57:17 +02:00
Laszlo Ersek
21ccddecf7 docs: clarify sockdir's separation
There's another reason for separating sockdir from tmpdir, beyond "shorter
pathnames needed": permissions. For example, passt drops privileges such
that it cannot access "/tmp", and that restricts both the unix domain
socket and the PID file of passt.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2184967
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Message-Id: <20230714132213.96616-5-lersek@redhat.com>
2023-07-14 17:57:15 +02:00
Laszlo Ersek
b4a4b754c6 docs: fix broken link in the guestfs manual
Commit 55202a4d49 ("New API: get-sockdir", 2016-02-03) added identical
language to "fish/guestfish.pod" and "src/guestfs.pod", including an
internal link L</get-sockdir>. That's appropriate for
"fish/guestfish.pod", but the same API description is generated with a
different anchor for "src/guestfs.pod". Adapt the reference.

Fixes: 55202a4d49
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2184967
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Message-Id: <20230714132213.96616-4-lersek@redhat.com>
2023-07-14 17:57:14 +02:00
Laszlo Ersek
190609377f lib/launch-libvirt: support networking with passt
We generate the <interface type="user"> element on libvirt 3.8.0+ already.

For selecting passt rather than SLIRP, we only need to insert the child
element <backend type='passt'>. Make that child element conditional on
libvirt 9.0.0+, plus "passt --help" being executable.

For the latter, place the new helper function guestfs_int_passt_runnable()
in "lib/launch.c" -- we're going to use the same function for the direct
backend as well.

This change exposes a number of (perceived) shortcomings in libvirt; I've
filed <https://bugzilla.redhat.com/show_bug.cgi?id=2222766> about those.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2184967
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Message-Id: <20230714132213.96616-3-lersek@redhat.com>
2023-07-14 17:57:13 +02:00
Laszlo Ersek
85d361dd6a lib: fix NETWORK_ADDRESS: make it an actual IP address, not a subnet base
Currently we #define NETWORK_ADDRESS as "169.254.0.0". That's a bug in
libguestfs, but it's been invisible -- thus far it's been canceled out by
*independent* bugs in *both* QEMU and libvirt.

(1) With the direct backend, the current definition of NETWORK_ADDRESS
results in the following QEMU command line option:

  -netdev user,id=usernet,net=169.254.0.0/16

According to the QEMU documentation, the "net" property here is supposed
to specify the *exact* IP address that the guest will receive. The guest
however receives 169.254.2.15 (I've checked that with virt-rescue).

In other words, libguestfs doesn't do what the QEMU documentation says,
and QEMU doesn't do what the QEMU documentation says either. The end
result has been good enough -- but only until now.

(2) With the libvirt backend, the current definition of NETWORK_ADDRESS
results in the following domain XML snippet:

  <interface type="user">
    <model type="virtio"/>
    <ip family="ipv4" address="169.254.0.0" prefix="16"/>
  </interface>

which libvirt translates, in turn, to

  -netdev {"type":"user","net":"169.254.0.0/16","id":"hostnet0"}

According to the domain XML documentation, the @address attribute here is
again supposed to specify the *exact* IP address that the guest will
receive. However, the guest receives 169.254.2.15 (I've checked that with
virt-rescue).

In other words, libguestfs doesn't do what the libvirt documentation says,
and libvirt doesn't do what the libvirt documentation says either. The end
result has been good enough -- but only until now.

Where things break down though is the subsequent passt enablement, in the
rest of this series. For example, when using the libvirt backend together
with passt, libvirt translates the @address attribute to passt's
"--address" option, but passt takes the address *verbatim*, and not as a
subnet base address. That difference is visible in the appliance; for
example, when running virt-rescue on a Fedora 38 image, and issuing "ip
addr". Namely, after enabling passt for the libvirt backend, the
guest-visible IP address changes from 169.254.2.15 to 169.254.0.0, which
is an IP address that makes no sense for an endpoint.

Fix the latent bug by specifying the actual guest IP address we want, in
NETWORK_ADDRESS.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2184967
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Message-Id: <20230714132213.96616-2-lersek@redhat.com>
2023-07-14 17:57:10 +02:00
Laszlo Ersek
13c7052ff9 lib: remove guestfs_int_cmd_clear_close_files()
The last (only?) caller of guestfs_int_cmd_clear_close_files() disappeared
in commit e4c3968880 ("lib/info: Remove /dev/fd hacking and pass a true
filename to qemu-img info.", 2018-01-23), part of v1.37.36.

Simplify the code by removing guestfs_int_cmd_clear_close_files().

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20230711113906.107340-1-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2023-07-12 12:22:37 +02:00
rwmjones
f6fddee305 Merge pull request #122 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2023-07-11 15:17:25 +01:00
Weblate
2dcda6a76a Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2023-07-05 16:21:05 +02:00
Temuri Doghonadze
e8f4b1a247 Translated using Weblate (Georgian)
Currently translated at 16.1% (156 of 966 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/ka/
2023-07-05 16:21:05 +02:00
Richard W.M. Jones
d8e48bff21 generator: Add --chown option for virt-customize
Also this updates the common submodule to include the changes.

Fixes: https://github.com/rwmjones/guestfs-tools/issues/12
Acked-by: Laszlo Ersek <lersek@redhat.com>
2023-06-29 17:14:43 +01:00
Richard W.M. Jones
cade0b1aeb ocaml: Use Caml_state_opt in preference to caml_state
Link: https://discuss.ocaml.org/t/test-caml-state-and-conditionally-caml-acquire-runtime-system-good-or-bad/12489/7
Thanks: Guillaume Munch-Maccagnoni
2023-06-27 16:33:09 +01:00
Richard W.M. Jones
7d4e9c927e ocaml: Fix guestfs_065_implicit_close.ml for OCaml 5
Link: https://discuss.ocaml.org/t/ocaml-5-forcing-objects-to-be-collected-and-finalized/12492/3
Thanks: Josh Berdine
Thanks: Vincent Laviron
2023-06-27 16:25:14 +01:00
Richard W.M. Jones
27998ecb2f Revert "ocaml/t/guestfs_065_implicit_close.ml: Skip this test on OCaml 5"
This reverts commit 81093d5359.
2023-06-27 16:20:29 +01:00
Richard W.M. Jones
8470269582 Version 1.51.4. 2023-06-27 14:10:29 +01:00
Richard W.M. Jones
81093d5359 ocaml/t/guestfs_065_implicit_close.ml: Skip this test on OCaml 5
Link: https://discuss.ocaml.org/t/ocaml-5-forcing-objects-to-be-collected-and-finalized/12492/2
2023-06-27 13:28:15 +01:00
Richard W.M. Jones
16464878cf ocaml: Conditionally acquire the lock in callbacks
This fix was originally suggested by Jürgen Hötzel (link below) which
I have lightly modified so it works with OCaml <= 4 too.

Link: https://listman.redhat.com/archives/libguestfs/2023-May/031640.html
Link: https://discuss.ocaml.org/t/test-caml-state-and-conditionally-caml-acquire-runtime-system-good-or-bad/12489
2023-06-27 12:46:41 +01:00
Richard W.M. Jones
4a79c023e5 ocaml: Release runtime lock around guestfs_close
When finalizing the handle we call guestfs_close.  This function could
be long-running (eg. it may have to shut down the qemu subprocess), so
release the runtime lock.
2023-06-27 12:46:18 +01:00
Richard W.M. Jones
7e1d7c1330 ocaml: Replace old enter/leave_blocking_section calls
Since OCaml 4 the old and confusing caml_enter_blocking_section and
caml_leave_blocking_section calls have been replaced with
caml_release_runtime_system and caml_acquire_runtime_system (in that
order).  Use the new names.
2023-06-27 11:34:21 +01:00
Jürgen Hötzel
1274452d22 ocaml/implicit_close test: collect all currently unreachable blocks
Fixes failing implice_close test on OCaml 5.

RWMJ:

I adjusted this patch so that we continue to call Gc.compact on
exiting the test, to move all of the heap (hopefully revealing flaws
in the bindings).  This only works on OCaml <= 4, but Gc.compact may
be fixed/reimplemented later in the 5.x series.

Please see also the lengthy discussion of this patch upstream:
https://listman.redhat.com/archives/libguestfs/2023-May/thread.html#31639
https://listman.redhat.com/archives/libguestfs/2023-June/thread.html#31709
https://discuss.ocaml.org/t/ocaml-heap-fsck-and-forcing-collection-of-unreachable-objects/12281/1
2023-06-06 15:53:03 +01:00
rwmjones
7f35e37d75 Merge pull request #114 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2023-06-05 09:41:48 +01:00
Weblate
89ef6c3bd3 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2023-05-30 18:21:04 +02:00
Tian Shixiong
b882458fb6 Translated using Weblate (Chinese (Simplified) (zh_CN))
Currently translated at 2.5% (25 of 966 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/zh_CN/
2023-05-30 18:21:04 +02:00
Pavel Borecki
e785a0bd88 Translated using Weblate (Czech)
Currently translated at 46.2% (447 of 966 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/cs/
2023-05-30 18:21:04 +02:00
Jan Kuparinen
dcca66f885 Translated using Weblate (Finnish)
Currently translated at 9.4% (91 of 966 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/fi/
2023-05-30 18:21:03 +02:00
grimst
fc1df0248a Translated using Weblate (French)
Currently translated at 16.6% (2666 of 16046 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/fr/

Translated using Weblate (French)

Currently translated at 64.0% (619 of 966 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/fr/

Translated using Weblate (French)

Currently translated at 16.6% (2664 of 16046 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/fr/
2023-05-30 18:21:03 +02:00
Richard W.M. Jones
ca20f27cb0 fuse: Don't call fclose(NULL) on error paths
Various errors like this:

In function ‘test_fuse’,
    inlined from ‘main’ at test-fuse.c:133:11:
test-fuse.c:274:5: error: argument 1 null where non-null expected [-Werror=nonnull]
  274 |     fclose (fp);
      |     ^~~~~~~~~~~
In file included from test-fuse.c:26:
/usr/include/stdio.h: In function ‘main’:
/usr/include/stdio.h:183:12: note: in a call to function ‘fclose’ declared ‘nonnull’
  183 | extern int fclose (FILE *__stream) __nonnull ((1));
      |            ^~~~~~
2023-05-22 17:21:07 +01:00
Richard W.M. Jones
3cb094083e Replace Pervasives.* with Stdlib.*
Since OCaml 4.07 (released 2018-07-10) the always-loaded standard
library module has been called Stdlib.  The old Pervasives module was
finally removed in OCaml 5.

$ perl -pi.bak -e 's/Pervasives\./Stdlib./g' -- `git ls-files`

OCaml >= 4.07 is now required.

Also update the common submodule with:

  commit d61cd820b49e403848d15c5deaccbf8dd7045370
  Author: Jürgen Hötzel
  Date:   Sat May 20 18:16:40 2023 +0200

    Add support for OCaml 5.0
2023-05-22 16:42:31 +01:00
Laszlo Ersek
32408a9c36 LUKS-on-LVM inspection test: test /dev/mapper/VG-LV translation
In the LUKS-on-LVM inspection test, call the "check_filesystems" function
yet another time, now with such "--key" options that exercise the recent
"/dev/mapper/VG-LV" -> "/dev/VG/LV" translation (unescaping) from
libguestfs-common.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2168506
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20230519140849.310774-4-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2023-05-22 14:23:55 +02:00
Laszlo Ersek
58e2640233 LUKS-on-LVM inspection test: rename VGs and LVs
In preparation for a subsequent patch, rename "VG" to "Volume-Group", and
"LV<n>" to "Logical-Volume-<n>", in the LUKS-on-LVM inspection test.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2168506
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20230519140849.310774-3-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2023-05-22 14:23:53 +02:00
Laszlo Ersek
83afd6d3d2 update common submodule
Laszlo Ersek (2):
      options/keys: key_store_import_key(): un-constify "key" parameter
      options/keys: introduce unescape_device_mapper_lvm()

Richard W.M. Jones (1):
      mlcustomize/SELinux_relabel.ml: Use Array.mem

Roman Kagan (1):
      mlcustomize: skip SELinux relabeling if it's disabled

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2168506
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20230519140849.310774-2-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2023-05-22 14:23:44 +02:00
Zixun LI
692802bf96 daemon/tar: support more compression methods.
Add support for lzma and zstd compression methods.

Signed-off-by: Zixun LI <admin@hifiphile.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2023-05-02 11:15:02 +01:00
Andrey Drobyshev
d0d8e67384 daemon/selinux-relabel: run setfiles with "-T 0", if supported
Since SELinux userspace v3.4 [1], setfiles command supports "-T nthreads"
option, which allows parallel execution.  "-T 0" allows using as many
threads as there're available CPU cores.  This might speed up the process
of filesystem relabeling in case the appliance is being run with multiple
vCPUs.  The latter is true for at least v2v starting from d2b64ecc67
("v2v: Set the number of vCPUs to same as host number of pCPUs.").

For instance, when running virt-v2v-in-place on my 12-core Xeon host
with SSD, with appliance being run with 8 vCPUs (the upper limit specified
in d2b64ecc67), and on the ~150GiB disk VM (physical size on the host),
I get the following results:

./in-place/virt-v2v-in-place -i libvirt fedora37-vm -v -x

Without this patch:
...
commandrvf: setfiles -F -e /sysroot/dev -e /sysroot/proc -e /sysroot/sys -m -C -r /sysroot -v /sysroot/etc/selinux/targeted/contexts/files/file_contexts /sysroot/^M
libguestfs: trace: v2v: selinux_relabel = 0
libguestfs: trace: v2v: rm_f "/.autorelabel"
guestfsd: => selinux_relabel (0x1d3) took 17.94 secs
...

With this patch:
...
commandrvf: setfiles -F -e /sysroot/dev -e /sysroot/proc -e /sysroot/sys -m -C -T 0 -r /sysroot -v /sysroot/etc/selinux/targeted/contexts/files/file_contexts /sysroot/^M
libguestfs: trace: v2v: selinux_relabel = 0
libguestfs: trace: v2v: rm_f "/.autorelabel"
guestfsd: => selinux_relabel (0x1d3) took 5.88 secs
...

So in my scenario it's getting 3 times faster.

[1] https://github.com/SELinuxProject/selinux/releases/tag/3.4

Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2023-04-27 15:22:02 +01:00
Andrey Drobyshev
152d6e4bdf daemon/selinux-relabel: search for "invalid option" in setfiles output
'X' in the setiles' stderr doesn't necessarily mean that option 'X'
doesn't exist.  For instance, when passing '-T' we get: "setfiles:
option requires an argument -- 'T'".

Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2023-04-27 15:21:54 +01:00
Andrey Drobyshev
9ced5fac8c daemon/selinux-relabel: don't exclude "/selinux" if it's non-existent
Since RHBZ#726528, filesystem.rpm doesn't include /selinux.  setfiles
then gives us the warning: "Can't stat exclude path "/sysroot/selinux",
No such file or directory - ignoring."

Though the warning is harmless, let's get rid of it by checking the
existence of /selinux directory.

Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2023-04-27 15:21:35 +01:00
Richard W.M. Jones
7674d603e9 Version 1.51.3. 2023-04-19 13:03:03 +01:00
Laszlo Ersek
be11d25b3e update common submodule
HATAYAMA Daisuke (1):
      progress: fix segmentation fault when TERM variable is "dumb"

Laszlo Ersek (2):
      detect_kernels: tighten "try" scope
      detect_kernels: deal with RHEL's kernel-core / kernel-modules-core split

rwmjones (1):
      Merge pull request #5 from d-hatayama/fix_segfault_progress_bar

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2175703
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
2023-03-21 17:07:42 +01:00
Laszlo Ersek
7414ac40c7 update common submodule
Andrey Drobyshev (2):
      inject_virtio_win: add Virtio_SCSI to block_type
      inject_virtio_win: write the proper block controller PCI ID to Win registry

Richard W.M. Jones (2):
      mlcustomize: Fix overlong comment
      mlcustomize: Add accessors for block driver priority list

Roman Kagan (1):
      inject_virtio_win: match only vendor/device/revision

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
2023-03-14 14:15:29 +01:00
rwmjones
f372a37b30 Merge pull request #111 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2023-02-28 12:31:59 +00:00
Weblate
ff92849818 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2023-02-25 11:20:43 +01:00
Temuri Doghonadze
4f51ca04c2 Translated using Weblate (Georgian)
Currently translated at 16.1% (156 of 966 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/ka/
2023-02-25 11:20:43 +01:00
Richard W.M. Jones
8c5df4110b Version 1.51.2. 2023-02-21 22:41:30 +00:00
Richard W.M. Jones
ab52362320 build: Set release date correctly in web page
This was not being set because of some impenetrable problem with
autoconf.  The actual line which set the shell variable was simply
being deleted for some reason.  Using an m4 definition works.

Updates: commit f68752462e
2023-02-21 20:55:48 +00:00
Richard W.M. Jones
b6a3689d89 website: Fix paths to development and stable releases on the website 2023-02-21 20:46:28 +00:00
rwmjones
89441f1626 Merge pull request #110 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2023-02-21 20:26:37 +00:00
Yuri Chornoivan
6abe575ef8 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (966 of 966 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/uk/
2023-02-21 21:20:29 +01:00
rwmjones
47c0ca8e03 Merge pull request #109 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2023-02-20 21:08:07 +00:00
Weblate
9ef18ea048 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2023-02-20 20:20:57 +01:00
Temuri Doghonadze
3588ad51c2 Translated using Weblate (Georgian)
Currently translated at 14.5% (141 of 967 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/ka/
2023-02-20 20:20:57 +01:00
Richard W.M. Jones
cfe7d39b40 Update common submodule to latest 2023-02-20 19:00:12 +00:00
Richard W.M. Jones
4ed83ffdbe valgrind: Add another libvirt suppression
It seems as if this is just a variation on the previous libvirt
suppression.

==2042391== 61 (48 direct, 13 indirect) bytes in 1 blocks are definitely lost in
 loss record 267 of 507
==2042391==    at 0x4846464: calloc (vg_replace_malloc.c:1340)
==2042391==    by 0x54EE318: g_malloc0 (gmem.c:163)
==2042391==    by 0x5017D4C: virClassNew (virobject.c:189)
==2042391==    by 0x523CCB9: virDataTypesOnce.lto_priv.0 (datatypes.c:111)
==2042391==    by 0x4D8BE42: __pthread_once_slow (pthread_once.c:116)
==2042391==    by 0x50345E1: virOnce (virthread.c:44)
==2042391==    by 0x523CD6A: virGetConnect (datatypes.c:121)
==2042391==    by 0x51FBC1F: virConnectOpenInternal (libvirt.c:893)
==2042391==    by 0x51FCC11: virConnectOpenAuth (libvirt.c:1271)
==2042391==    by 0x4A3ECAD: guestfs_int_open_libvirt_connection.constprop.0 (li
bvirt-auth.c:224)
==2042391==    by 0x4A1D62A: launch_libvirt.lto_priv.0 (launch-libvirt.c:389)
==2042391==    by 0x4993739: guestfs_launch (launch.c:114)

(cherry picked from guestfs-tools commit 8790af0266a808c8a04927bb5039be06cbc3da54)
2023-02-20 18:59:36 +00:00
Richard W.M. Jones
ede3632612 valgrind: Update suppression for PCRE2 transition
OCaml PCRE.compile doesn't free up regexps if they are stored in
globals.  However the valgrind suppression for this matched the old
function name, not the new PCRE2 name.  Valgrind errors looked like:

==1799651== 145 bytes in 1 blocks are possibly lost in loss record 2,927 of 4,168
==1799651==    at 0x484186F: malloc (vg_replace_malloc.c:381)
==1799651==    by 0x4D5F2E5: pcre2_compile_8 (pcre2_compile.c:10250)
==1799651==    by 0x29E077: guestfs_int_pcre_compile (pcre-c.c:196)
==1799651==    by 0x2B725F: camlOVA__entry (OVA.ml:392)
==1799651==    by 0x2859A8: caml_program (in /home/rjones/d/virt-v2v/v2v/virt-v2v)
==1799651==    by 0x40F9D8: caml_start_program (in /home/rjones/d/virt-v2v/v2v/virt-v2v)
==1799651==    by 0x40FD86: caml_startup_common (in /home/rjones/d/virt-v2v/v2v/virt-v2v)
==1799651==    by 0x40FDDC: caml_startup (in /home/rjones/d/virt-v2v/v2v/virt-v2v)
==1799651==    by 0x28523F: main (in /home/rjones/d/virt-v2v/v2v/virt-v2v)

(cherry picked from virt-v2v commit 2949109ff9f7a081b1a4b475b9f7bcbef5b45ee0)
2023-02-20 18:59:27 +00:00
Richard W.M. Jones
250ee85839 Rework Std_utils.Option so it works like the OCaml stdlib module
OCaml 4.08 introduces a stdlib Option module which looks a bit like
ours but has a number of differences.  In particular our functions
Option.may and Option.default have no corresponding functions in
stdlib, although there are close enough equivalents.

This change was automated using this command:

$ perl -pi.bak \
  -e 's/Option.may/Option.iter/g; s/Option.default /Option.value ~default:/g' \
  `git ls-files`

Update common module to include:

  commit cffa077323fafcdfcf78e230c022afa891a6b3ff
  Author: Richard W.M. Jones <rjones@redhat.com>
  Date:   Mon Feb 20 12:11:51 2023 +0000

    mlstdutils: Rework the Option module to be compatible with stdlib
2023-02-20 12:14:08 +00:00
Richard W.M. Jones
afa4d64fca python: Avoid leaking py_array and py_args in event callbacks
See also:

https://listman.redhat.com/archives/libguestfs/2023-February/030730.html
https://listman.redhat.com/archives/libguestfs/2023-February/030745.html
https://listman.redhat.com/archives/libguestfs/2023-February/030746.html

Fixes: commit 6ef5837e2d
Thanks: Laszlo Ersek, Eric Blake
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2023-02-20 11:21:33 +00:00
Richard W.M. Jones
e07304de86 Revert "python: fix call of Python handlers of events"
This reverts one part of commit 85235aec83 related to reference
counts.  Py_BuildValue always increments the reference count (when it
succeeds) and I could not reproduce the Python 3 problem that was
described there.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2023-02-20 11:21:14 +00:00
Richard W.M. Jones
f68752462e build: Remove RELEASES file
The presence of this file complicates ./configure and you also have to
remember to update it on each release.  Replace it with a simple
RELEASE_DATE set in ./configure when the version is updated.

I also had to make a minor change to the generator which was using
this file both to check it was run from the source directory and to
get an exclusive lock.  We now use podwrapper.pl.in for this.
2023-02-16 11:58:30 +00:00
Richard W.M. Jones
c7d54697ca rust: Don't fail 'make distclean' if cargo clean fails
It fails when run twice with:

  ../run cargo clean
  error: could not find `Cargo.toml` in `/home/rjones/d/libguestfs/rust` or any parent directory

As this is an optional step don't fail here.
2023-02-16 11:58:30 +00:00
Richard W.M. Jones
b9ccfe3e03 lib: Get rid of minimum libvirt version check
We require libvirt >= 0.10.2, and we included code to check this at
configure-, compile- and run-time.  Remove the checks at compile and
run time (keep the ./configure check).  Libvirt 0.10.2 was released
over 10 years ago so it's safe to assume that everyone has it by now.
2023-02-16 11:58:30 +00:00
Richard W.M. Jones
bbf396fc55 python: Use bytes instead of str for event callback buffer
The event callback gets a buffer parameter which is usually something
like a log message.  However as it comes from C it is not necessarily
well-formed (eg) UTF-8 but could contain any old sequence of bytes.

In the test case provided by the reporter, we failed to encode the
buffer as 'str' with this error:

  UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 137: unexpected end of data

Use 'bytes' instead.  Strictly speaking this changes the type
signature of the callbacks, but our existing Python tests which just
print the buffer using '%s' don't fail and in any case we don't
guarantee the stability of non-C APIs.

Reported-by: Yonatan Shtarkman
See: https://listman.redhat.com/archives/libguestfs/2023-February/030653.html
2023-02-14 19:29:48 +00:00
Richard W.M. Jones
6ef5837e2d python: Avoid crash if callback parameters cannot be built
In the case that building the parameters to the Python event callback
fails, args was returned as NULL.  We immediately tried to call
Py_INCREF on this which crashed.  Returning NULL means the Python
function threw an exception, so print the exception and return (there
is no way to return an error here - the event is lost).

Reported-by: Yonatan Shtarkman
See: https://listman.redhat.com/archives/libguestfs/2023-February/030653.html
2023-02-14 18:42:40 +00:00
Richard W.M. Jones
43bb5c4306 Version 1.51.1. 2023-02-10 11:09:55 +00:00
Richard W.M. Jones
f0f8e6c5fe lib: Choose q35 machine type for x86-64
This machine type is more modern than the older 'pc' type and as most
qemu development is now focused there we expect it will perform and
behave better.  In almost all respects this change should make no
difference.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2168578
Acked-by: Laszlo Ersek <lersek@redhat.com>
See-also: https://listman.redhat.com/archives/libguestfs/2023-February/030645.html
2023-02-09 14:40:29 +00:00
Richard W.M. Jones
7503eeebed Remove virt-dib
The tool only supports an older version of the diskimage-builder
metadata, and we do not have the time or inclination to update it to a
newer version.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1910039
2023-02-07 13:30:35 +00:00
Richard W.M. Jones
ceb1cf50e6 Version 1.50.0. 2023-02-07 11:23:45 +00:00
Richard W.M. Jones
e2c7bddf10 Update copyright dates for 2023
Run this command across the source:

  perl -pi.bak -e 's/(20[012][0-9])-20[12][012]/$1-2023/g' `git ls-files`

and remove changes to po{,-docs}/*.po{,t} (these will be regenerated
later when we run 'make dist').
2023-02-07 10:50:48 +00:00
rwmjones
e4f0733bd7 Merge pull request #108 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2023-02-05 15:31:05 +00:00
Weblate
a1822fa1c6 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2023-02-05 16:20:48 +01:00
Emilio Herrera
4bdefd23d3 Translated using Weblate (Spanish)
Currently translated at 2.0% (335 of 16046 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/es/
2023-02-05 16:20:48 +01:00
Richard W.M. Jones
34d378cef2 docs: Add outline release notes for forthcoming 1.50 stable release 2023-01-31 15:54:46 +00:00
Richard W.M. Jones
4f58017a5e lib/guestfs-internal-all.h: Use __restrict__ keyword for very old GCC
RHEL 7 GCC 4.8.5 does not allow the restrict keyword.  Use the
permitted alternative.
2023-01-31 15:54:46 +00:00
Richard W.M. Jones
8f6b82bc45 lib/guestfs-internal-all.h: Fix whitespace 2023-01-31 15:54:46 +00:00
Richard W.M. Jones
973e26dbd8 Update common module
Update common module to 3253cd99d135d5eb788a0477459b43a269e8cca6

No significant changes that affect virt-v2v now, but it adds some
extra functions to Std_utils that might be used one day.

Cherry picked from virt-v2v commit c7c9dac4f84580190b0e4f7c2e68970192f4bad3
2023-01-28 15:06:33 +00:00
Richard W.M. Jones
09c2a5404a Version 1.49.9. 2023-01-19 23:29:00 +00:00
Richard W.M. Jones
ed8a960bb8 build: Ignore new common/mldrivers in maintainer-check-extra-dist
This directory is not distributed in the tarball.

Fixes: commit 1a6485001c
2023-01-19 23:28:14 +00:00
Richard W.M. Jones
1a6485001c Update common submodule 2023-01-19 23:00:36 +00:00
Richard W.M. Jones
fbf7fe8793 build: Remove bundled copy of ocaml-augeas
This is now an external dependency.
2023-01-19 23:00:23 +00:00
Richard W.M. Jones
e0d23c861c generator: customize: Add --inject-qemu-ga and --inject-virtio-win
Add the new flags / operations for virt-customize.
2023-01-17 11:59:00 +00:00
rwmjones
76599aae80 Merge pull request #107 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2023-01-13 20:23:51 +00:00
Temuri Doghonadze
f325b26e4b Translated using Weblate (Georgian)
Currently translated at 14.4% (140 of 967 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/ka/
2023-01-13 21:20:16 +01:00
rwmjones
c75a323bf0 Merge pull request #106 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2022-12-23 19:04:18 +00:00
Jan Kuparinen
7dea806091 Translated using Weblate (Finnish)
Currently translated at 0.8% (138 of 16048 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/fi/
2022-12-23 19:20:01 +01:00
Temuri Doghonadze
c2d20611f2 Translated using Weblate (Georgian)
Currently translated at 14.3% (139 of 967 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/ka/
2022-12-23 19:20:01 +01:00
rwmjones
b258185eb4 Merge pull request #105 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2022-12-13 21:14:20 +00:00
Yuri Chornoivan
ad02353bf9 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (967 of 967 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/uk/
2022-12-12 20:20:02 +01:00
rwmjones
23ae55a470 Merge pull request #104 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2022-12-11 19:26:10 +00:00
Weblate
56b1345399 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2022-12-11 17:21:32 +01:00
Emilio Herrera
747ae003d5 Translated using Weblate (Spanish)
Currently translated at 2.0% (330 of 16046 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/es/
2022-12-11 17:21:31 +01:00
Richard W.M. Jones
73fb8719d2 Version 1.49.8. 2022-12-10 12:17:12 +00:00
Andrey Drobyshev
188aa9947f m4/guestfs-appliance.m4: add VIRTUOZZO to RedHat-based distros
This allows to detect VzLinux guest.

Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
2022-12-09 19:01:00 +00:00
Richard W.M. Jones
a84ff62478 tests/nbd: Remove bogus sleep
This is no longer needed since qemu-nbd now supports pidfiles

Fixes: commit 1eb055bd46
2022-12-02 12:02:49 +00:00
Richard W.M. Jones
dc9bdda084 tests/nbd: Unlink pidfile before running qemu-nbd
It might be left over from a previous failed run.  Best to unlink the
old file before starting qemu-nbd, so there's no possibility of
getting confused later when we wait for the file to appear.
2022-12-02 11:57:16 +00:00
Richard W.M. Jones
98ab261a05 tests/nbd: Move temporary files into tests/nbd/ subdirectory
This test fails for reasons I have not fully understood yet.  However
one thing I noticed is that the Unix domain socket and PID file used
the tests are placed in the tests/ directory, not the tests/nbd/
subdirectory, so let's fix that:

Starting qemu-nbd fedora-nbd.img -t --pid-file /home/rjones/d/libguestfs-rhel-9.2/tests/nbd.pid --format raw -p 63668 ...
Starting qemu-nbd fedora-nbd.img -t --pid-file /home/rjones/d/libguestfs-rhel-9.2/tests/nbd.pid --format raw -p 60684 ...
Starting qemu-nbd fedora-nbd.img -t --pid-file /home/rjones/d/libguestfs-rhel-9.2/tests/nbd.pid --format raw -k /home/rjones/d/libguestfs-rhel-9.2/tests/unix.sock ...

Fixes: commit 6d32773e81
2022-12-02 11:38:17 +00:00
Richard W.M. Jones
824c745748 lib: Return correct osinfo field for Windows 11
For Windows Client, we can only distinguish between Windows 10 and
Windows 11 using the build ID.  The product name in both cases is
"Windows 10 <something>", apparently intentionally.

References:
https://learn.microsoft.com/en-us/answers/questions/586619/windows-11-build-ver-is-still-10022000194.html
a263fe0b26/winsup/cygwin/wincap.cc (L429)
https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions

After this fix, the output of virt-inspector changes to this, which is
a bit odd, but correct:

    <name>windows</name>
    <arch>x86_64</arch>
    <distro>windows</distro>
    <product_name>Windows 10 Pro</product_name>
    <product_variant>Client</product_variant>
    <major_version>10</major_version>
    <minor_version>0</minor_version>
    <windows_systemroot>/Windows</windows_systemroot>
    <windows_current_control_set>ControlSet001</windows_current_control_set>
    <osinfo>win11</osinfo>

Thanks: Yaakov Selkowitz
Reported-by: Yongkui Guo
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2012658
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2022-12-02 10:16:57 +00:00
Richard W.M. Jones
f3dd67affe New API: inspect_get_build_id
Add an API to return the build ID of the guest.  This to allow a
future change to be able to distinguish between Windows 10 and Windows 11
which can only be done using the build ID.

For Windows we can read the CurrentBuildNumber key from the registry.
For Linux there happens to be a BUILD_ID field in /etc/os-release.
I've never seen a Linux distro that actually uses this.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2022-12-02 10:16:57 +00:00
rwmjones
6efb44c4ff Merge pull request #103 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2022-12-01 20:47:31 +00:00
Yuri Chornoivan
32467fc6d4 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (966 of 966 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/uk/
2022-12-01 20:19:49 +01:00
rwmjones
6397dbca64 Merge pull request #102 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2022-11-30 19:25:54 +00:00
Weblate
5c864d1e80 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2022-11-30 19:20:36 +01:00
Temuri Doghonadze
772d7cb61f Translated using Weblate (Georgian)
Currently translated at 14.3% (138 of 965 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/ka/
2022-11-30 19:20:35 +01:00
Richard W.M. Jones
55fdf761b1 Version 1.49.7. 2022-11-28 11:08:52 +00:00
Richard W.M. Jones
fa305b709a python: Fix code style ("missing whitespace after keyword") 2022-11-28 10:32:21 +00:00
Richard W.M. Jones
23986d3c4f file: Use -S option with -z
The file(1) manual suggests using -S (disable seccomp) with -z since
the set of system calls provided by the seccomp policy does not allow
the subprocess to run.  This is obvious when you use file -z on a
compressed file on a Linux distro that enables file's seccomp policy
(Arch does this, Fedora does not):

  $ file -zbsL lib-i586.so.zst
  Bad system call

I also fixed some incorrect text in the manual.

Thanks: Toolybird for pointing to this fix
Reported-by: David Runge
Fixes: https://github.com/libguestfs/libguestfs/issues/100
2022-11-28 10:21:00 +00:00
Richard W.M. Jones
e657e45b43 tests: Increase size of disk in xfs_growfs_0 test
I cannot reproduce the originally reported error:

libguestfs: error: mkfs: xfs: /dev/VG/LV: Filesystem must be larger than 300MB.

Thanks: David Runge
Related: https://github.com/libguestfs/libguestfs/issues/100
2022-11-22 16:32:08 +00:00
Richard W.M. Jones
6bfb73cdb0 gnulib/lib/c-ctype.h: Remove executable bit
$ ls -l `find -name c-ctype.h`
-rwxr-xr-x. 1 rjones rjones 9647 Dec  3  2021 ./gnulib/lib/c-ctype.h
$ chmod -x `find -name c-ctype.h`
$ ls -l `find -name c-ctype.h`
-rw-r--r--. 1 rjones rjones 9647 Dec  3  2021 ./gnulib/lib/c-ctype.h

RPM builds actually gave a warning about this which is how I noticed
the problem:

*** WARNING: ./usr/src/debug/guestfs-tools-1.48.2-2.fc36.x86_64/gnulib/lib/c-ctype.h is executable but has no shebang, removing executable bit

(cherry picked from
guestfs-tools commit 566267a3d447eb97b4a0637adbe3e45c09ba090f)
2022-11-21 21:13:37 +00:00
Richard W.M. Jones
1bcf0bc5dd Version 1.49.6. 2022-11-21 16:46:05 +00:00
Richard W.M. Jones
d5472a2219 appliance: Add back libldm (ldmtool) and libxml2 to package list
Commit 133a491677 ("Use guestfsd binary to auto-generate library
dependencies for appliance", October 2020) removed explicit
dependencies for various system packages that the daemon links
directly to, ie. all of these libraries:

$ objdump -p daemon/guestfsd | grep NEEDED | sort
  NEEDED               libacl.so.1
  NEEDED               libaugeas.so.0
  NEEDED               libcap.so.2
  NEEDED               libc.so.6
  NEEDED               libgcc_s.so.1
  NEEDED               libhivex.so.0
  NEEDED               libjansson.so.4
  NEEDED               libm.so.6
  NEEDED               libpcre2-8.so.0
  NEEDED               librpm.so.9
  NEEDED               libselinux.so.1
  NEEDED               libsystemd.so.0
  NEEDED               libtirpc.so.3
(plus libyara which I don't have installed.)

This avoids having to update these dependencies if they change, eg.
when we switched from PCRE to PCRE2 we did not need to update this
file.

However the same commit also incorrectly removed two apparent library
packages (libldm, libxml2) which the daemon does not link to, but
which we'd like to pull in because of tools they provide, in
particular ldmtool.

Re-add those two explicit dependencies.

Fixes: commit 133a491677
2022-11-07 12:44:07 +00:00
Richard W.M. Jones
26940f64a7 build: Replace Python distutils by sysconfig
This module has been deprecated in Python >= 3.10
(https://peps.python.org/pep-0632/).  Replace distutils.sysconfig with
sysconfig which is not quite a drop-in replacement.

This fix is incomplete as we still reference distutils in
python/setup.py.in.  However that is only used for PIP-style
distributions (make -C python sdist) which we don't really use or
recommend.

Thanks: Miro Hrončok
See-also: https://peps.python.org/pep-0632/
See-also: https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/N6ITYHLRWIDNYNXGPYG2ZHF3ZLQWZN7L/
2022-10-24 17:11:31 +01:00
Richard W.M. Jones
5c63ec2a53 gobject: Remove bogus NULL test for UUIDs
Many warnings such as:

src/session.c: In function 'guestfs_session_internal_test_rstruct':
src/session.c:14755:7: warning: the comparison will always evaluate as 'true' for the address of 'pv_uuid' will never be NULL [-Waddress]
14755 |   if (ret->pv_uuid) memcpy (s->pv_uuid, ret->pv_uuid, sizeof (s->pv_uuid));
      |       ^~~
In file included from src/session.c:40:
../include/guestfs.h:551:8: note: 'pv_uuid' declared here
  551 |   char pv_uuid[32]; /* this is NOT nul-terminated, be careful when printing */
      |        ^~~~~~~
2022-10-24 11:27:53 +01:00
Richard W.M. Jones
19c40e6717 gobject: Use G_ADD_PRIVATE
Deprecation warnings include:

src/optargs-xfs_growfs.c: In function 'guestfs_xfs_growfs_init':
src/optargs-xfs_growfs.c:311:13: warning: Deprecated pre-processor symbol: replace with "G_ADD_PRIVATE"
  311 |   o->priv = GUESTFS_XFS_GROWFS_GET_PRIVATE (o);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is based on the same change made here:

https://github.com/nzjrs/osm-gps-map/pull/78/files
2022-10-24 11:25:42 +01:00
Richard W.M. Jones
001683e885 appliance: Remove LD_PRELOAD=libSegFault.so
This feature was removed in glibc 2.35:
https://savannah.gnu.org/forum/forum.php?forum_id=10111
2022-10-24 10:41:09 +01:00
Richard W.M. Jones
3f5bdce111 Update common submodule
utils: Fix rogue include of nbdkit-plugin.h
2022-10-15 08:07:42 +01:00
Richard W.M. Jones
e1c9bbb3d1 lib: Avoid calling setenv between fork and exec
setenv can call malloc and is not safe to call here.  Glibc is usually
tolerant of this and we haven't had problems before, but if you use
GLIBC_TUNABLES glibc.malloc.check=1 (or any alternate malloc / libc
which serializes) then you would see hangs if starting multiple
libguestfs handles from different threads at the same time.

This commit also updates the common submodule to pick up:

  commit 3c64bcdeaf684f05f46f3928b55aadafdfe72720
  Author: Richard W.M. Jones <rjones@redhat.com>
  Date:   Fri Oct 14 11:07:21 2022 +0100

    utils: Add function for copying the environment and adding new entries

    libguestfs is currently calling setenv at an unsafe location between
    fork and exec.  To fix this we need a way to copy and modify the
    environment before fork and then we can pass the modified environ to
    execve-like functions.  nbdkit already does the same so use that code.

    This function is copied and adapted from here under a compatible license:
    https://gitlab.com/nbdkit/nbdkit/-/blob/master/common/utils/environ.c

Thanks: Siddhesh Poyarekar
2022-10-14 11:40:12 +01:00
Richard W.M. Jones
4004e8eb36 appliance: Create symlink /etc/crypto-policies/back-ends/opensslcnf.config
Downstream patched openssl in Fedora 37+ broke unless
/etc/crypto-policies/back-ends/opensslcnf.conf is present.  Files in
this directory are generated by %post rules that use scripting
languages so cannot easily be created by supermin.

Add a symlink to the DEFAULT policy file if the configuration file
doesn't exist.

A symptom of this problem is the error:

  Requested hash sha256 is not supported.
  Failed to set pbkdf parameters.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2133884
Updates: commit d6ba398825
2022-10-12 12:42:15 +01:00
Richard W.M. Jones
f73c653cc0 Revert "appliance: Copy in /etc/crypto-policies/back-ends/ files"
This reverts commit d6ba398825.
2022-10-12 10:08:14 +01:00
Richard W.M. Jones
d6ba398825 appliance: Copy in /etc/crypto-policies/back-ends/ files
Downstream patched openssl in Fedora 37+ broke unless
/etc/crypto-policies/back-ends/opensslcnf.conf is present.  Files in
this directory are generated by %post rules that use scripting
languages so cannot easily be created by supermin.

Force a copy of the host files into the appliance.  This is not ideal
and is hopefully a temporary fix until Fedora's openssl is fixed.

A symptom of this problem is the error:

  Requested hash sha256 is not supported.
  Failed to set pbkdf parameters.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2133884
2022-10-11 21:59:49 +01:00
Richard W.M. Jones
cf89757883 Version 1.49.5. 2022-10-11 14:54:08 +01:00
Richard W.M. Jones
c2dd84b263 daemon: Make vg_scan and lvm_scan no-ops if no LVM feature
If the LVM ("lvm2") feature is not available, these calls would fail.
Really they ought to be part of the "lvm2" optgroup which would cause
the generator to call reply_with_unavailable_feature and generate the
correct ENOTSUP error.  When vgscan was originally added in 2010 it
was not added to the optgroup, and when lvm_scan was later added in
2018 and deprecating vgscan, the same mistake was copied.

Before this commit they will try to run the lvm pvscan command which
will fail returning some other error (instead of ENOTSUP).

Fix this by turning the calls into no-ops if the LVM feature is not
available, since scanning for LVM objects when there is no LVM can be
safely turned into a no-op.

See also
https://listman.redhat.com/archives/libguestfs/2022-September/thread.html#29908

Also this updates the common module to pick up a related fix:

  commit 4b4a5b84647b1496d034bcdff910930ca5f5c486
  Author: Richard W.M. Jones <rjones@redhat.com>
  Date:   Fri Sep 23 15:18:43 2022 +0100

    options: Don't attempt to scan LVs if "lvm2" feature is not available

Reported-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Fixes: 55dfcb2211 ("New API: lvm_scan, deprecate vgscan")
Fixes: 9752039e52 ("New API: vgscan")
2022-09-27 15:53:48 +01:00
rwmjones
57d1812091 Merge pull request #97 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2022-09-06 13:00:53 +01:00
Weblate
b18a71ef1b Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2022-09-06 11:19:52 +02:00
Temuri Doghonadze
6501d78bd4 Translated using Weblate (Georgian)
Currently translated at 0.9% (9 of 965 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/ka/
2022-09-06 11:19:51 +02:00
Richard W.M. Jones
5e1f158c40 gnulib: Fix replacement functions for pipe2/accept4
gnulib itself has a replacement for <unistd.h> which redefines pipe2
as rpl_pipe2 (etc), which is why the apparently recursive call in the
implementation of pipe2 isn't actually recursive.  Since I didn't copy
that file, none of that worked and instead on platforms which have
pipe2 it recursed.

Reported-by: Laszlo Ersek
Fixes: commit 908e41e556
2022-08-17 14:58:52 +01:00
Richard W.M. Jones
e13a77e865 common: Update common submodule
commit 9d40590852e0755d4719adf97122758fa98e90f9
  Author: Richard W.M. Jones <rjones@redhat.com>
  Date:   Tue Aug 16 16:19:29 2022 +0100

    options/decrypt.c: Ignore #pragma GCC with clang
2022-08-16 16:31:34 +01:00
Richard W.M. Jones
03fadae09e common: Update common submodule
commit fd4062248271c1e026e3349fdcd4f9fc99e8f0c7
  Author: Richard W.M. Jones <rjones@redhat.com>
  Date:   Tue Aug 16 16:10:39 2022 +0100

    options/decrypt.c: Ignore probably bogus GCC -Werror=stringop-overflow

  commit 9d66f02807c7abdfbceba162a94c38cf474cf48b
  Author: Richard W.M. Jones <rjones@redhat.com>
  Date:   Tue Aug 16 15:56:46 2022 +0100

    windows/windows.c: Remove ignore -Wanalyzer-null-argument

  commit 0e4fdabcb6be5fc61dfc7b45cc5cb6db3d341494
  Author: Richard W.M. Jones <rjones@redhat.com>
  Date:   Tue Aug 16 15:46:22 2022 +0100

    mlpcre/pcre-c.c: Remove unused variable
2022-08-16 16:12:06 +01:00
Richard W.M. Jones
39d66abc04 fish/tilde.c: Remove ignore -Wanalyzer-null-argument
Added in 2021 as a workaround for GCC 11 and since fixed upstream.

On macOS (clang):

tilde.c:43:32: error: unknown warning group '-Wanalyzer-null-argument', ignored [-Werror,-Wunknown-warning-option]
                               ^
tilde.c:86:32: error: unknown warning group '-Wanalyzer-null-argument', ignored [-Werror,-Wunknown-warning-option]
                               ^
2 errors generated.
2022-08-16 16:00:09 +01:00
Richard W.M. Jones
8d50637741 gnulib: Copy in error(3) replacement from gnulib
This is available under a compatible license (LGPLv2+).
2022-08-16 16:00:09 +01:00
Richard W.M. Jones
347e875911 lib: Remove -Wanalyzer-file-leak ignores
These were added for GCC 11.  The problem has been fixed in GCC 12.
On macOS (clang) these produced errors like this:

tsk.c:75:32: error: unknown warning group '-Wanalyzer-file-leak', ignored [-Werror,-Wunknown-warning-option]
                               ^
2022-08-16 15:42:30 +01:00
Richard W.M. Jones
5fe33b685a lib/readdir.c: Include <rpc/types.h> before <rpc/xdr.h>
On macOS, several pages of errors like:

In file included from readdir.c:26:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/rpc/xdr.h:126:3: error: type name requires a specifier or qualifier
                bool_t  (*x_getlong)(struct __rpc_xdr *, int *);
                ^
2022-08-16 15:40:23 +01:00
Richard W.M. Jones
e7f28159fb lib/launch.c: Include <signal.h> for sigemptyset, etc
launch.c:191:3: error: implicit declaration of function 'sigemptyset' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  sigemptyset (&sigset);
  ^
launch.c:192:3: error: implicit declaration of function 'sigaddset' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  sigaddset (&sigset, SIGTERM);
  ^
launch.c:193:3: error: implicit declaration of function 'sigprocmask' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  sigprocmask (SIG_UNBLOCK, &sigset, NULL);
  ^
3 errors generated.
2022-08-16 15:38:51 +01:00
Richard W.M. Jones
ef947a9d3b gnulib: Use system getprogname on macOS 2022-08-16 15:37:52 +01:00
Richard W.M. Jones
908e41e556 gnulib: Copy in pipe2 and accept4 replacements from gnulib
These are shipped under a compatible license (LGPLv2+ or LGPLv3+).
2022-08-16 15:37:52 +01:00
Richard W.M. Jones
6be5430314 common: Update common submodule
commit 1bf092f3c22e93c152de9dea3f5c13df23dc571c
  Author: Richard W.M. Jones <rjones@redhat.com>
  Date:   Tue Aug 16 15:08:40 2022 +0100

    utils: Include <stdio.h> for FILE*
2022-08-16 15:37:52 +01:00
Richard W.M. Jones
b018b35bd4 lib: Remove dtrace/systemtap probes
These were added in libguestfs 1.14, but never really used.  Only a
handful of probes were available.  When I was benchmarking libguestfs
in 2016 I didn't even use these probes because better/simpler
techniques were available.
2022-08-16 15:35:17 +01:00
Richard W.M. Jones
df5805df63 configure: Use AC_FUNC_STRERROR_R
Update common submodule to include modified strerror_r replacement
2022-08-16 14:15:11 +01:00
Richard W.M. Jones
6c0e5d7f8f protocol: Replace missing xdr_uint64_t on macOS
The macOS rpcgen actually generates calls to xdr_uint64_t but doesn't
define them.  Despite this we can just use xdr_int64_t instead since
it's just byte swapping.
2022-08-16 14:03:59 +01:00
Richard W.M. Jones
c51d1cfe9a m4: Check for GNU realpath program
It is a dependency of the ocaml-dep.sh script, required for all builds.
2022-08-16 13:45:14 +01:00
Richard W.M. Jones
be60075b16 m4: Don't check for DISTRO with --disable-appliance
It is only used when building the appliance and for nothing else.
2022-08-16 13:40:15 +01:00
Richard W.M. Jones
0b3c6cc0c0 daemon: Remove remaining uses of custom printf %Q and %R
We have traditionally used custom printf formatters %Q and %R, where
%Q replaces the argument with a shell-quoted string, and %R replaces
the argument with a sysroot-prefixed shell-quoted string.  They are
actually pretty useful, but unfortunately only supported by glibc.

We only used them in about a dozen places in the daemon (much code
having been replaced by OCaml which does not need them).

In every remaining case we were constructing a command using code like
this:

  asprintf_nowarn (&cmd,
         "cd %Q && find -print0 | %s -0 -o -H %s --quiet", ...);

We can replace this with:

  char *cmd;
  size_t cmd_size;
  fp = open_memstream (&cmd, &cmd_size);
  fprintf (fp, "cd ");
  shell_quote (dir, fp);
  fprintf (fp, " && find -print0 | %s -0 -o -H %s --quiet", ...);
  fclose (fp);
2022-08-16 10:39:01 +01:00
Richard W.M. Jones
ad8b1b09ee daemon: grub: Remove incorrect use of printf specifier %R
This code is attempting to construct a grub-install command like:

  grub-install --root-directory=/sysroot/boot /dev/sda

In fact it was adding quoting to the --root-directory parameter where
it was not needed (because our "command" function uses exec).

Remove use of %R here (to avoid the extra quoting) and just use the
sysroot prefix directly.
2022-08-16 10:21:33 +01:00
Richard W.M. Jones
0e784824e8 daemon: Add zstd support to guestfs_file_architecture
This is required so we can determine the file architecture of
zstd-compressed Linux kernel modules as used by OpenSUSE and maybe
other distros in future.

Note that zstd becomes a required package, but it is widely available
in current Linux distros.

The package names come from https://pkgs.org/download/zstd and my own
research.
2022-08-09 19:04:41 +01:00
Richard W.M. Jones
d8fce89eca Version 1.49.4. 2022-08-01 15:15:55 +01:00
rwmjones
6f8e014958 Merge pull request #93 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2022-08-01 13:49:31 +01:00
Yuri Chornoivan
7dbd49d1aa Translated using Weblate (Ukrainian)
Currently translated at 100.0% (965 of 965 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/uk/
2022-08-01 14:19:07 +02:00
Piotr Drąg
1fbdc4386a Translated using Weblate (Polish)
Currently translated at 53.8% (520 of 965 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/pl/
2022-08-01 14:19:06 +02:00
Weblate
0d4b8de8b1 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2022-08-01 14:19:06 +02:00
Temuri Doghonadze
f968e9b955 Translated using Weblate (Georgian)
Currently translated at 0.8% (8 of 956 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/ka/
2022-08-01 14:19:05 +02:00
Richard W.M. Jones
4a517601c7 daemon: Parse /etc/hostname files containing comments
Thanks: Dawid Zamirski
Link: https://www.freedesktop.org/software/systemd/man/hostname.html
Acked-by: Laszlo Ersek <lersek@redhat.com>
2022-07-20 13:22:39 +01:00
Richard W.M. Jones
adfaf25a12 m4: Fix ./configure --disable-ocaml
OCaml is required to compile libguestfs, however we should still be
able to disable the OCaml bindings.  This didn't work because using
--disable-ocaml caused various configure tests to be skipped which are
required to compile the daemon.  In particular the check for
caml_alloc_initialized_string, resulting in this error:

pcre-c.c:47:1: error: static declaration of ‘caml_alloc_initialized_string’ follows non-static declaration
 caml_alloc_initialized_string (mlsize_t len, const char *p)
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Also OCaml gettext is not required by libguestfs.  There are no *.ml
files used by libguestfs which require translation.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2108425
Fixes: https://bugs.gentoo.org/820053
Fixes: commit 733d2182b6
2022-07-20 10:11:09 +01:00
Richard W.M. Jones
7149312632 lib: Don't use -cpu max on RISC-V
qemu (7.0) does not support -cpu max for TCG.

Note this change is necessary but not sufficient for getting
libguestfs to run on RISC-V, because there is also currently no
working path to make -kernel work.
2022-07-15 17:10:56 +01:00
Richard W.M. Jones
d68d1b2780 Version 1.49.3. 2022-07-01 15:27:25 +01:00
Richard W.M. Jones
1342626b33 valgrind: Add new suppressions for OCaml 4.14 2022-07-01 15:22:46 +01:00
Richard W.M. Jones
f16fcdcfa2 fuse/test-fuse.c: Partially disable test because of caching
Previously we noted in a comment that stat("hello.txt") is cached (and
not called again), so the test of the link count failed.  Something
has changed, possibly in the kernel, but it results in even more
aggressive caching so that an earlier, similar test also fails in the
same way.  I checked by enabling debugging that the stat call doesn't
result in guestfs_lstatns being called, and the old value for the
statbuf was being returned.
2022-07-01 15:12:23 +01:00
Laszlo Ersek
6a5b44f538 guestfish, guestmount: enable networking for "--key ID:clevis"
Call the C-language helper key_store_requires_network() in guestfish and
guestmount.

(Short log for the "common" submodule, commit range
35467027f657..af6cb55bc58a:

Laszlo Ersek (12):
      options: fix UUID comparison logic bug in get_keys()
      mltools/tools_utils: remove unused function "key_store_to_cli"
      mltools/tools_utils: allow multiple "--key" options for OCaml tools too
      options: replace NULL-termination with number-of-elements in get_keys()
      options: wrap each passphrase from get_keys() into a struct
      options: add back-end for LUKS decryption with Clevis+Tang
      options: introduce selector type "key_clevis"
      options: generalize "--key" selector parsing for C-language utilities
      mltools/tools_utils-c: handle internal type error with abort()
      mltools/tools_utils: generalize "--key" selector parsing for OCaml utils
      options, mltools/tools_utils: parse "--key ID:clevis" options
      options, mltools/tools_utils: add helper for network dependency
).

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1809453
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Message-Id: <20220630122048.19335-4-lersek@redhat.com>
2022-07-01 15:11:06 +02:00
Laszlo Ersek
9a3e9a6c03 introduce the "clevis_luks_unlock" API
Introduce a new guestfs API called "clevis_luks_unlock". At the libguestfs
level, it is quite simple; it wraps the "clevis luks unlock" guest command
(implemented by the "clevis-luks-unlock" executable, which is in fact a
shell script).

The complexity is instead in the network-based disk encryption
(Clevis/Tang) scheme. Useful documentation:

- https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html-single/security_hardening/index#configuring-automated-unlocking-of-encrypted-volumes-using-policy-based-decryption_security-hardening
- https://github.com/latchset/clevis#clevis
- https://github.com/latchset/tang#tang

The package providing "clevis-luks-unlock" is usually called
"clevis-luks", occasionally "clevis". Some distros don't package clevis at
all. Add the new API under a new option group (which may not be available)
called "clevisluks".

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1809453
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220630122048.19335-3-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2022-07-01 15:07:26 +02:00
Laszlo Ersek
99844660b4 docs/guestfs-security: document CVE-2022-2211
Short log for the common submodule, commit range
f8de5508fe75..35467027f657:

Laszlo Ersek (2):
      mlcustomize: factor out pkg install/update/uninstall from guestfs-tools
      options: fix buffer overflow in get_keys() [CVE-2022-2211]

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1809453
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2100862
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220628115418.5376-2-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2022-06-29 15:29:37 +02:00
rwmjones
4159f72bb7 Merge pull request #91 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2022-06-21 10:43:15 +01:00
Weblate
661c4f0bfb Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2022-06-18 19:45:25 +02:00
Temuri Doghonadze
2fdf19e49f Added translation using Weblate (Georgian) 2022-06-18 19:45:24 +02:00
Richard W.M. Jones
60e8ea0312 lib/readdir.c: Include unistd.h for unlink(2)
On riscv64:

readdir.c: In function ‘guestfs_impl_readdir’:
readdir.c:127:3: error: implicit declaration of function ‘unlink’ [-Werror=implicit-function-declaration]
  127 |   unlink (tmpfn);
      |   ^~~~~~

I also changed the #include lines to make them look a bit more
like use in other files.
2022-06-17 13:25:48 +01:00
Richard W.M. Jones
1087d314cc daemon: Remove workaround for -Wanalyzer-mismatching-deallocation
On older GCC:

debug.c:116:32: error: unknown option after ‘#pragma GCC diagnostic’ kind [-Werror=pragmas]
  116 | #pragma GCC diagnostic ignored "-Wanalyzer-mismatching-deallocation"
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [Makefile:2039: guestfsd-debug.o] Error 1

The upstream bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99193)
has now been fixed so the workaround is not necessary with the latest
GCC, so just delete the workaround.
2022-06-17 13:24:19 +01:00
Geoff Amey
ec27979398 php: add arginfo to php bindings
Starting with PHP8, arginfo is mandatory for PHP extensions. This patch
updates the generator for the PHP bindings to generate the arginfo
structures, using the Zend API macros. Only basic arginfo is added,
without full documentation of argument and return types, in order to
ensure compatibility with as many versions of PHP as possible.
2022-06-15 22:29:28 +01:00
Laszlo Ersek
8fc4d16715 appliance, daemon: disable lvm2 devicesfile
In guestfs-tools commit 4fe8a03cd2d3 ('sysprep: remove lvm2's default
"system.devices" file', 2022-04-11), we disabled the use of LVM2's new
"devicesfile" feature, which could interfere with the cloning of virtual
machines.

We suspected in

  https://bugzilla.redhat.com/show_bug.cgi?id=2072493#c6

that the same lvm2 feature could affect the libguestfs appliance itself,
but decided in

  https://bugzilla.redhat.com/show_bug.cgi?id=2072493#c8
  https://bugzilla.redhat.com/show_bug.cgi?id=2072493#c10

that this would not be the case, because "appliance/init" already
constructed a pristine LVM_SYSTEM_DIR.

Unfortunately, that's not enough: due to the "use_devicesfile=1" default
(on RHEL9 anyway), some "lvm" invocation, possibly inside the
lvm-set-filter API, *creates* "$LVM_SYSTEM_DIR/devices/system.devices".
And then we get (minimally) warnings such as

> Please remove the lvm.conf global_filter, it is ignored with the devices
> file.
> Please remove the lvm.conf filter, it is ignored with the devices file.

when using the lvm-set-filter API.

Explicitly disable the "devices file" in "appliance/init", and also
whenever we rewrite "lvm.conf" -- that is, in set_filter()
[daemon/lvm-filter.c]. In the former, check for the feature by locating
the devicesfile-related utilities "lvmdevices" and "vgimportdevices". In
the C code, invoke the utilities with the "--help" option instead. (In
"appliance/init",  I thought it was best not to call any lvm2 utilities
even with "--help", with our lvm2.conf still under construction there.) If
either utility is available, set "use_devicesfile = 0".

Cc: David Teigland <teigland@redhat.com>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1965941
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220530141027.16167-1-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
[lersek@redhat.com: style fix: break "devicesfile_feature" in the function
 definition to a new line]
2022-05-31 08:47:58 +02:00
Richard W.M. Jones
7afbf5ee44 build: Pick first field in ID_LIKE
CentOS Stream has:

ID_LIKE="rhel fedora"

which confused the existing script.  If there are multiple "likes"
arbitrarily pick the first one in the list.

Fixes: commit 63b722b6c0
2022-05-26 14:11:01 +01:00
Richard W.M. Jones
4b1fd3f154 Version 1.49.2. 2022-05-26 11:17:09 +01:00
Richard W.M. Jones
a1b0c4162e build: Add .gitpublish to EXTRA_DIST
Found by: make dist && make maintainer-check-extra-dist

Fixes: commit 8487e906d4
2022-05-26 10:48:32 +01:00
Richard W.M. Jones
488245ed6c daemon: rpm: Check return values from librpm calls
We previously didn't bother to check the return values from any librpm
calls.  In some cases where possibly the RPM database is faulty, this
caused us to return a zero-length list of installed applications (but
no error indication).

One way to reproduce this is given below.  Note this reproducer will
only work when run on a RHEL 8 host (or more specifically, with
rpm <= 4.16):

$ virt-builder fedora-28
$ guestfish -a fedora-28.img -i rm /var/lib/rpm/Packages
$ guestfish --ro -a fedora-28.img -i inspect-list-applications /dev/sda4 -vx
...
chroot: /sysroot: running 'librpm'
error: cannot open Packages index using db5 - Read-only file system (30)
error: cannot open Packages database in
error: cannot open Packages index using db5 - Read-only file system (30)
error: cannot open Packages database in
librpm returned 0 installed packages
...

With this commit we get an error instead:

...
chroot: /sysroot: running 'librpm'
error: cannot open Packages index using db5 - Read-only file system (30)
error: cannot open Packages database in
ocaml_exn: 'internal_list_rpm_applications' raised 'Failure' exception
guestfsd: error: rpmtsInitIterator
guestfsd: => internal_list_rpm_applications (0x1fe) took 0.01 secs
libguestfs: trace: internal_list_rpm_applications = NULL (error)
libguestfs: error: internal_list_rpm_applications: rpmtsInitIterator
libguestfs: trace: inspect_list_applications2 = NULL (error)
libguestfs: trace: inspect_list_applications = NULL (error)
...

Not in this case, but in some cases of corrupt RPM databases it is
possible to recover them by running "rpmdb --rebuilddb" as a guest
command (ie. with guestfs_sh).

See-also: https://bugzilla.redhat.com/show_bug.cgi?id=2089623#c12
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2089623
Fixes: commit c9ee831aff
Reported-by: Xiaodai Wang
Reported-by: Ming Xie
Acked-by: Laszlo Ersek <lersek@redhat.com>
2022-05-26 10:16:21 +01:00
Laszlo Ersek
9e69a38d82 update common submodule
Shortlog for 48527b8768d7..f8de5508fe75:

Laszlo Ersek (1):
      mlcustomize: refresh generated files

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2089748
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
2022-05-25 13:01:57 +02:00
Laszlo Ersek
4b9ee1052a generator/customize: reintroduce "--selinux-relabel" as a compat option
Removing "--selinux-relabel" in commit 2f6a27f107 ("generator/customize:
invert SELinux relabeling default", 2022-05-11) breaks existing scripts
that invoke virt-customize and/or virt-sysprep with that option. Restore
the option, with no functionality tied to it.

Fixes: 2f6a27f107
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2089748
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220525071958.9612-1-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2022-05-25 12:58:51 +02:00
Richard W.M. Jones
63b722b6c0 build: When parsing distro from /etc/os-release, try $ID_LIKE first
The current code for working out the distro uses the ID entry from
/etc/os-release, and then we map those strings into a smaller set of
values (basically, what package manager to use).  However it was
suggested that we should try ID_LIKE first so that distros which act
like other distros would work.  On an Arch Linux 32 system:

ID=arch32
ID_LIKE=arch

See-also: https://github.com/libguestfs/libguestfs/issues/81
Thanks: S D Rausty
2022-05-22 18:36:11 +01:00
Richard W.M. Jones
4418e6345a appliance: Error out if QUERY_FILES_CMD cannot be set
Instead of continuing on regardless and failing with a weird error
later, error out early if we don't know about the distro and so cannot
set QUERY_FILES_CMD.  This avoids situations like
https://github.com/libguestfs/libguestfs/issues/81
2022-05-21 17:19:54 +01:00
Richard W.M. Jones
bf5fcdbc9b appliance: Print guestfsd.deps after generation
Sometimes generating this file fails.  To help with debugging these
situatons, print the guestfsd.deps file after it has been generated.
2022-05-21 11:11:59 +01:00
rwmjones
79010dec83 Merge pull request #88 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2022-05-20 21:19:00 +01:00
Jan Kuparinen
7bbd5f9394 Translated using Weblate (Finnish)
Currently translated at 9.4% (90 of 956 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/fi/
2022-05-20 20:18:43 +02:00
Laszlo Ersek
544bb0ff50 guestfs.pod: document encrypted RBD disk limitation
Under "REMOTE STORAGE", the "NETWORK BLOCK DEVICE" section already
documents some limitations. Turns out we need to describe a quirky
exception for accessing encrypted RBD disks, too.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2033247
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220518083014.9890-1-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2022-05-19 14:11:43 +02:00
rwmjones
307757f850 Merge pull request #87 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2022-05-19 08:48:02 +01:00
Yuri Chornoivan
3f0c0a3a1a Translated using Weblate (Ukrainian)
Currently translated at 100.0% (956 of 956 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/uk/
2022-05-18 22:18:35 +02:00
Richard W.M. Jones
feaec2497f website: Fix typo in previous commit
Fixes: commit 53d6c000b4
2022-05-18 16:09:24 +01:00
Richard W.M. Jones
53d6c000b4 website: List only the 1.48 stable branch on the website 2022-05-18 16:08:22 +01:00
Kashyap Chamarthy
8487e906d4 git: Add 'git-publish' config file
The `git-publish`[1] tool is a wrapper around `git-format-patch` and
`git-send-email`.  It's a handy tool that automates some of the tedious
aspects of manual patch submission:

  - Submitting a patch to the list (with a small config in place) is as
    simple as `git publish`

  - On next revisions, it automatically increments version numbers

  - It auto-copies the list of To: and Cc: from your previous iteration

  - It lets you preview/edit emails before submission

  - You can also use standard `git-format-patch` and `git-send-email`
    options with `git publish`

  - You can send pull requests with `git publish --pull-request`

  - It also provides custom hooks ... and more[2]

[1] https://github.com/stefanha/git-publish
[2] https://github.com/stefanha/git-publish/blob/master/git-publish.pod

Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
2022-05-18 16:03:18 +01:00
Kashyap Chamarthy
16cf069b61 website: Update 'git clone' protocol
GitHub dropped[1] support for git: protocol, so cloing with "git://"
will fail.  Use "https://" instead.

[1] https://github.blog/2021-09-01-improving-git-protocol-security-github/

Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
2022-05-18 16:03:18 +01:00
rwmjones
8a111cb82a Merge pull request #86 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2022-05-17 21:22:35 +01:00
Weblate
856a87041c Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2022-05-17 21:20:01 +02:00
Jan Kuparinen
ae4ae83007 Translated using Weblate (Finnish)
Currently translated at 0.8% (137 of 16048 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/fi/
2022-05-17 21:20:01 +02:00
Neil Hanlon
a3487ef4c5 build: Add ROCKY to REDHAT distros list 2022-05-16 09:48:05 +01:00
Richard W.M. Jones
59d7e6e017 lib: Disable 5-level page tables when using -cpu max
In https://bugzilla.redhat.com/show_bug.cgi?id=2082806 we've been
tracking an insidious qemu bug which intermittently prevents the
libguestfs appliance from starting.  The symptoms are that SeaBIOS
starts and displays its messages, but the kernel isn't reached.  We
found that the kernel does in fact start, but when it tries to set up
page tables and jump to protected mode it gets a triple fault which
causes the emulated CPU in qemu to reset (qemu exits).

This seems to only affect TCG (not KVM).

Yesterday I found that this is caused by using -cpu max which enables
the "la57" feature (5-level page tables[0]), and that we can make the
problem go away using -cpu max,la57=off.  Note that I still don't
fully understand the qemu bug, so this is only a workaround.

I chose to disable 5-level page tables for both TCG and KVM, partly to
make the patch simpler, and partly because I guess it's not a feature
(ie. 57 bit linear addresses) that is useful for the libguestfs
appliance case, where we have limited physical memory and no need to
run any programs with huge address spaces.

I tested this by running both the direct & libvirt paths overnight.  I
expect that this patch will fail with old qemu/libvirt which doesn't
understand the "la57" feature, but this is only intended as a
temporary workaround.

[0] Article about 5-level page tables as background:
https://lwn.net/Articles/717293/

Thanks: Laszlo Ersek
Fixes: https://answers.launchpad.net/ubuntu/+source/libguestfs/+question/701625
Acked-by: Laszlo Ersek <lersek@redhat.com>
2022-05-13 13:00:28 +01:00
Richard W.M. Jones
a4f668fad3 Version 1.49.1. 2022-05-12 14:45:14 +01:00
Laszlo Ersek
a39b79f607 daemon/selinux-relabel: tolerate relabeling errors
Option "-C" of setfiles(8) causes setfiles(8) to exit with status 1 rather
than status 255 if it encounters relabeling errors, but no other (fatal)
error. Pass "-C" to setfiles(8) in "selinux-relabel", because we don't
want the "selinux-relabel" API to fail if setfiles(8) only encounters
relabeling errors.

(NB even without "-C", setfiles(8) continues traversing the directory
tree(s) and relabeling files across relabeling errors, so this change is
specifically about the exit status.)

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1794518
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220511122345.14208-3-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2022-05-11 17:02:17 +02:00
Laszlo Ersek
5345d42635 daemon/selinux-relabel: generalize setfiles_has_m_option()
Allow the caller to pass in the option to check for, and to store the
result in a (usually static) variable of their choice.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1794518
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220511122345.14208-2-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2022-05-11 17:01:57 +02:00
Laszlo Ersek
08c4ac90f5 update common submodule
Laszlo Ersek (2):
      mlcustomize: refresh generated files
      remove non-generated "--selinux-relabel" options

Richard W.M. Jones (2):
      options/uri.c: Fix missing word in error message
      options/uri.c: Free variable on error path

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1554735
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2075718
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
2022-05-11 05:26:48 +02:00
Laszlo Ersek
2f6a27f107 generator/customize: invert SELinux relabeling default
Replace the "--selinux-relabel" option with "--no-selinux-relabel",
inverting the default behavior (for guests with SELinux support, that is
-- relabeling is always skipped for guests that don't support SELinux.)

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1554735
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2075718
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220510102757.14466-3-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2022-05-11 05:16:32 +02:00
Laszlo Ersek
8541db057c generator/customize: document that "--selinux-relabel" checks for SELinux
The documentation currently says that the user should avoid passing
"--selinux-relabel" on the command line if the guest does not support
SELinux. However, the "is_selinux_guest" helper function in
"common/mlcustomize/SELinux_relabel.ml" already turns "--selinux-relabel"
into a no-op if some key SELinux files are absent from the guest, so there
is no need to caution the user.

This change is relevant because the subsequent patches will turn on
"--selinux-relabel" by default, and therefore "is_selinux_guest" will grow
in importance.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1554735
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2075718
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220510102757.14466-2-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2022-05-11 05:16:17 +02:00
rwmjones
00b9ef2393 Merge pull request #83 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2022-05-10 16:36:15 +01:00
Emilio Herrera
7e9ff9e7f8 Translated using Weblate (Spanish)
Currently translated at 2.0% (328 of 16046 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/es/
2022-05-10 17:18:34 +02:00
Laszlo Ersek
ddf276884c tests/regressions: remove "iface"-based restrictions
Now that "iface" is ignored by both backends, the regression tests for
RHBZ 690819 and 975797 can be enabled on all arches (regardless of
backend).

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1844341
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220504134155.11832-5-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2022-05-05 13:05:23 +02:00
Laszlo Ersek
c8e3caf9e6 lib: rename VALID_FORMAT_IFACE to VALID_FORMAT
We no longer use VALID_FORMAT_IFACE for validating "iface"; rename the
macro to reflect that we only check "format" with it.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1844341
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220504134155.11832-4-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2022-05-05 13:05:21 +02:00
Laszlo Ersek
f68eaee1d6 lib: drive_create_data, drive: remove field "iface"
Representing "iface" in the "drive_create_data" and "drive" structures is
now useless; the direct backend ignores "iface", while the libvirt one
rejects it unless it is empty. Unify both backends -- make them both
ignore "iface". (Which only relaxes the libvirt backend, so it cannot
cause compatibility problems.) This lets us remove the fields. Update the
documentation as well.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1844341
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220504134155.11832-3-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2022-05-05 13:05:19 +02:00
Laszlo Ersek
3eb830dbae lib: launch-direct: ignore drive "iface" parameter
Rich said in <https://bugzilla.redhat.com/show_bug.cgi?id=1844341#c1>:

> The libvirt backend has never allowed the iface parameter.  We should
> probably ignore it in the direct backend since it's never been possible
> to use this parameter correctly.

Remove the handling of "iface" in the direct (QEMU) backend. Refresh the
documentation regarding both backends.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1844341
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220504134155.11832-2-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2022-05-05 13:05:07 +02:00
Laszlo Ersek
4864d21cb8 guestfs_readdir(): minimize the number of send_file_write() calls
In guestfs_readdir(), the daemon currently sends each XDR-encoded
"guestfs_int_dirent" to the library with a separate send_file_write()
call.

Determine the largest encoded size (from the longest filename that a
"guestfs_int_dirent" could carry, from readdir()'s "struct dirent"), and
batch up the XDR encodings until the next encoding might not fit in
GUESTFS_MAX_CHUNK_SIZE. Call send_file_write() only then.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1674392
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220502085601.15012-3-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2022-05-03 10:54:00 +02:00
Laszlo Ersek
45b7f1736b guestfs_readdir(): rewrite with FileOut transfer, to lift protocol limit
Currently the guestfs_readdir() API can not list long directories, due to
it sending back the whole directory listing in a single guestfs protocol
response, which is limited to GUESTFS_MESSAGE_MAX (approx. 4MB) in size.

Introduce the "internal_readdir" action, for transferring the directory
listing from the daemon to the library through a FileOut parameter.
Rewrite guestfs_readdir() on top of this new internal function:

- The new "internal_readdir" action is a daemon action. Do not repurpose
  the "readdir" proc_nr (138) for "internal_readdir", as some distros ship
  the binary appliance to their users, and reusing the proc_nr could
  create a mismatch between library & appliance with obscure symptoms.
  Replace the old proc_nr (138) with a new proc_nr (511) instead; a
  mismatch would then produce a clear error message. Assume the new action
  will first be released in libguestfs-1.48.2.

- Turn "readdir" from a daemon action into a non-daemon one. Call the
  daemon action guestfs_internal_readdir() manually, receive the FileOut
  parameter into a temp file, then deserialize the dirents array from the
  temp file.

This patch sneakily fixes an independent bug, too. In the pre-patch
do_readdir() function [daemon/readdir.c], when readdir() returns NULL, we
don't distinguish "end of directory stream" from "readdir() failed". This
rewrite fixes this problem -- I didn't see much value separating out the
fix for the original do_readdir().

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1674392
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220502085601.15012-2-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2022-05-03 10:53:48 +02:00
Richard W.M. Jones
ac00e603f8 New API: guestfs_device_name returning the drive name
For each drive added, return the name.  For example calling this with
index 0 will return the string "/dev/sda".  I called it
guestfs_device_name (not drive_name) for consistency with the existing
guestfs_device_index function.

You don't really need to call this function.  You can follow the
advice here:
https://libguestfs.org/guestfs.3.html#block-device-naming
and assume that drives are added with predictable names like
"/dev/sda", "/dev/sdb", etc.

However it's useful to expose the internal guestfs_int_drive_name
function since especially handling names beyond index 26 is tricky
(https://rwmj.wordpress.com/2011/01/09/how-are-linux-drives-named-beyond-drive-26-devsdz/)

Fixes: https://github.com/libguestfs/libguestfs/issues/80
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2022-05-02 12:10:29 +01:00
Richard W.M. Jones
f9babf8c04 m4: Add support for Artix
Fixes: https://github.com/libguestfs/libguestfs/issues/81
2022-04-29 15:16:25 +01:00
Richard W.M. Jones
b4081d0275 api: Note that drive "name" field is no longer used
Before commit 3a00c4d179 ("Remove inspection from the C library and
switch to daemon/OCaml implementation") in 2017 the name parameter
passed to add_drive was used by inspection to override the device name
that is determined from fstab.  None of our tools ever actually used
this parameter, and when the inspection code was moved inside the
daemon we stopped using this hint field at all.

So it's no longer used, and likely hasn't been used ever.  Therefore
document that the field does nothing.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2022-04-29 11:23:45 +01:00
Richard W.M. Jones
bf8b876b68 Update common submodule
mltools/tools_utils-c.c: Free keystore after decryption
2022-04-28 16:08:20 +01:00
Richard W.M. Jones
0a2d43988f build: No longer check for ocamldep -one-line and -all options
These were added to ocamldep in Jan 2012, over 10 years ago.  They
were not present in RHEL 6, but we don't care about that now.

(cherry picked from virt-v2v commit f6108bbd661d3e922d07b47f00daa901ab846e59)
2022-04-28 15:38:56 +01:00
Richard W.M. Jones
0956e8e0c5 tests: Fix isoinfo test to recognise cdrtools iso_volume_id
cdrtools writes "CDROM" into the Volume Identifier field in the PVD,
whereas genisoimage and xorriso write "ISOIMAGE".  Recognise either
string as valid in the test.

Fixes: https://github.com/libguestfs/libguestfs/issues/79
Reported-by: David Runge
2022-04-28 08:43:10 +01:00
Andrey Drobyshev
ef8c6593eb appliance: don't read extfs signature from QCOW2 image directly
If the appliance is a QCOW2 image, function get_root_uuid_with_file()
fails to read ext filesystem signature (0x53EF at offset 0x438) from it.
This results in the following error:

libguestfs: error: /usr/lib64/guestfs/appliance/root: appliance is not
an extfs filesystem

The error itself is harmless, but misleading.  So let's skip retrieving
the signature and UUID in case the image contains QCOW2 header.  It's
safe because in this case we'll retrieve it later from RAW image dumped
from that QCOW2 by "qemu-img dd".

Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
2022-04-25 20:54:48 +01:00
Richard W.M. Jones
bc96e0b7d7 daemon: Fix compilation with older rpm that lacks RPMVSF_MASK_NOSIGNATURES
On RHEL 7 (rpm-devel-4.11.3-45.el7.x86_64):

rpm-c.c: In function ‘guestfs_int_daemon_rpm_start_iterator’:
rpm-c.c:97:44: error: ‘RPMVSF_MASK_NOSIGNATURES’ undeclared (first use in this function)
   rpmtsSetVSFlags (ts, rpmtsVSFlags (ts) | RPMVSF_MASK_NOSIGNATURES);
                                            ^
rpm-c.c:97:44: note: each undeclared identifier is reported only once for each function it appears in

Fixes: commit aa6f8038f8
2022-04-25 16:40:12 +01:00
rwmjones
03a18f5f31 Merge pull request #77 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2022-04-16 07:20:27 +01:00
Weblate
7c7b9f53c3 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2022-04-15 22:17:29 +02:00
Pavel Borecki
1886a03acf Translated using Weblate (Czech)
Currently translated at 0.5% (5 of 955 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/cs/
2022-04-15 22:17:28 +02:00
Richard W.M. Jones
3d2f4e2ff3 Version 1.48.1. 2022-04-14 16:49:49 +01:00
Richard W.M. Jones
d64d2b7649 daemon/utils.ml: Replace Bytes.get_uint8 with native call
Bytes.get_uint8 was added in OCaml 4.08.  To support OCaml >= 4.04 (in
particular, RHEL 8 has OCaml 4.07) we have to replace this function
with the equivalent native call.  We can remove this commit once the
baseline OCaml moves up.

Updates: commit edfebee404
2022-04-14 11:32:35 +01:00
Laszlo Ersek
05419dbcec Update common submodule 2022-04-12 11:54:22 +02:00
Nikolay Shirokovskiy
af5ab47725 tests: fix rhbz1370424 to use proper path
Test fails as it cannot find .xml file. Turns out $pwd=./tests and
and not ./tests/regressions as supposed in script.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org>
2022-04-08 16:03:00 +01:00
Nikolay Shirokovskiy
5552ef1c46 tests: fix rhbz1044014 to use proper paths
Test fails as it cannot find .in file. Turns out $srcdir=. (which is ./tests) and
and not ./tests/regressions as supposed in script. Same apply to
$abs_srcdir.

Also put .out file in ./tests/regressions too.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org>
2022-04-08 16:03:00 +01:00
Richard W.M. Jones
3115726aca po-docs: Sort LINGUAS file 2022-03-31 16:36:53 +01:00
Jan Kuparinen
c2084acf06 Translated using Weblate (Finnish)
Currently translated at 9.2% (88 of 955 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/fi/
2022-03-27 09:32:33 +02:00
Yuri Chornoivan
02b3462097 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (955 of 955 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/uk/
2022-03-20 18:17:01 +01:00
Weblate
83cd69e99c Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2022-03-19 17:17:07 +01:00
Emilio Herrera
1c04024d13 Translated using Weblate (Spanish)
Currently translated at 2.0% (325 of 16046 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/es/
2022-03-19 17:17:04 +01:00
Jan Kuparinen
ffbcfb6659 Translated using Weblate (Finnish)
Currently translated at 8.9% (87 of 976 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/fi/
2022-03-19 17:17:04 +01:00
Weblate
c7b8f7e1e2 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2022-03-19 17:17:04 +01:00
Jan Kuparinen
219f3a1a62 Translated using Weblate (Finnish)
Currently translated at 0.8% (135 of 16048 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/fi/
2022-03-19 17:17:04 +01:00
Emilio Herrera
aaa3211ade Translated using Weblate (Spanish)
Currently translated at 1.9% (319 of 16046 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/es/
2022-03-19 17:17:03 +01:00
Ettore Atalan
8e157f0b05 Translated using Weblate (German)
Currently translated at 7.4% (1188 of 16046 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/de/
2022-03-19 17:17:03 +01:00
Ettore Atalan
ef605f400a Translated using Weblate (German)
Currently translated at 33.2% (325 of 976 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/de/
2022-03-19 17:17:03 +01:00
Jan Kuparinen
9a0a685304 Translated using Weblate (Finnish)
Currently translated at 8.8% (86 of 976 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/fi/

Translated using Weblate (Finnish)

Currently translated at 0.8% (130 of 16048 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/fi/
2022-03-19 17:17:03 +01:00
Yuri Chornoivan
85c41f314c Translated using Weblate (Ukrainian)
Currently translated at 100.0% (976 of 976 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/uk/
2022-03-19 17:17:03 +01:00
Piotr Drąg
052fa92472 Translated using Weblate (Polish)
Currently translated at 53.6% (524 of 976 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/pl/
2022-03-19 17:17:03 +01:00
Ricky Tigg
483b6b50f2 Translated using Weblate (Finnish)
Currently translated at 0.7% (123 of 16048 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/fi/
2022-03-19 17:17:03 +01:00
Jan Kuparinen
dd7107d1b9 Translated using Weblate (Finnish)
Currently translated at 8.7% (85 of 976 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/fi/

Translated using Weblate (Finnish)

Currently translated at 0.7% (121 of 16048 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/fi/

Translated using Weblate (Finnish)

Currently translated at 8.6% (84 of 975 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/fi/

Translated using Weblate (Finnish)

Currently translated at 0.6% (109 of 16048 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/fi/
2022-03-19 17:17:03 +01:00
Weblate
db28084ef0 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2022-03-19 17:17:03 +01:00
Ricky Tigg
3d0f5c1f76 Translated using Weblate (Finnish)
Currently translated at 8.5% (83 of 975 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/fi/

Translated using Weblate (Finnish)

Currently translated at 0.1% (24 of 16048 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/fi/

Translated using Weblate (Finnish)

Currently translated at 16.6% (292 of 1751 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/fi/

Added translation using Weblate (Finnish)
2022-03-19 17:17:03 +01:00
Weblate
8347a8a610 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2022-03-19 17:17:03 +01:00
Hela Basa
a9f93154f4 Translated using Weblate (Sinhala)
Currently translated at 0.1% (2 of 16048 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/si/

Added translation using Weblate (Sinhala)

Added translation using Weblate (Sinhala)
2022-03-19 17:17:02 +01:00
Emilio Herrera
88a219255f Translated using Weblate (Spanish)
Currently translated at 1.9% (312 of 16046 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/es/

Translated using Weblate (Spanish)

Currently translated at 1.9% (305 of 16046 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/es/

Translated using Weblate (Spanish)

Currently translated at 1.8% (296 of 16046 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/es/

Translated using Weblate (Spanish)

Currently translated at 1.7% (287 of 16046 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/es/
2022-03-19 17:17:02 +01:00
Piotr Drąg
abbe8ab88b Translated using Weblate (Polish)
Currently translated at 34.2% (600 of 1751 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/pl/

Translated using Weblate (Polish)

Currently translated at 34.0% (595 of 1749 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/pl/
2022-03-19 17:17:02 +01:00
Marcin Stanclik
b5c27c4dd4 Translated using Weblate (Polish)
Currently translated at 34.0% (595 of 1749 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/pl/
2022-03-19 17:17:02 +01:00
Ricky Tigg
58c4aea471 Translated using Weblate (Finnish)
Currently translated at 9.6% (169 of 1751 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/fi/

Translated using Weblate (Finnish)

Currently translated at 8.9% (156 of 1751 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/fi/

Translated using Weblate (Finnish)

Currently translated at 4.0% (71 of 1751 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/fi/
2022-03-19 17:17:02 +01:00
Weblate
f96eba6684 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2022-03-19 17:17:02 +01:00
Yuri Chornoivan
d00b8ece5b Translated using Weblate (Ukrainian)
Currently translated at 100.0% (1751 of 1751 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/uk/
2022-03-19 17:17:02 +01:00
Weblate
b3a1b03e8f Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2022-03-19 17:17:02 +01:00
Jan Kuparinen
f996e22c94 Translated using Weblate (Finnish)
Currently translated at 2.2% (40 of 1749 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/fi/

Added translation using Weblate (Finnish)
2022-03-19 17:17:02 +01:00
Adolfo Jayme Barrientos
c14861bd2c Translated using Weblate (Spanish)
Currently translated at 1.7% (286 of 16047 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/es/
2022-03-19 17:17:02 +01:00
Piotr Drąg
0999db62f6 Translated using Weblate (Polish)
Currently translated at 33.9% (594 of 1749 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/pl/

Translated using Weblate (Polish)

Currently translated at 33.7% (591 of 1749 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/pl/

Translated using Weblate (Polish)

Currently translated at 33.6% (589 of 1749 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/pl/

Translated using Weblate (Polish)

Currently translated at 33.4% (585 of 1749 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/pl/

Translated using Weblate (Polish)

Currently translated at 33.5% (587 of 1749 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/pl/

Translated using Weblate (Polish)

Currently translated at 30.4% (532 of 1749 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/pl/
2022-03-19 17:17:02 +01:00
Michał Smyk
c30c48a797 Translated using Weblate (Polish)
Currently translated at 30.4% (532 of 1749 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/pl/
2022-03-19 17:17:02 +01:00
Weblate
e560fcdf81 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2022-03-19 17:17:02 +01:00
Yuri Chornoivan
daf9b060b6 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (16047 of 16047 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/uk/

Translated using Weblate (Ukrainian)

Currently translated at 100.0% (1749 of 1749 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/uk/

Translated using Weblate (Ukrainian)

Currently translated at 100.0% (1749 of 1749 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/uk/

Translated using Weblate (Ukrainian)

Currently translated at 100.0% (1749 of 1749 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/uk/

Translated using Weblate (Ukrainian)

Currently translated at 97.1% (15589 of 16047 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/uk/

Translated using Weblate (Ukrainian)

Currently translated at 87.7% (1534 of 1749 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/uk/
2022-03-19 17:17:02 +01:00
Richard W.M. Jones
aa6f8038f8 daemon/rpm-c.c: Disable signature checking in librpm
Older distros (eg CentOS 6) used SHA-1 RPM package signatures which
some newer distros (eg RHEL 9.0) prevent us from verifying.

This resulted in packages with SHA-1 signatures being skipped by
librpm (there is a warning in debug output, but if you're not looking
at that then the package is silently ignored).  In some cases
essential packages like the kernel were skipped, which would be
visible as a failure of virt-v2v.  In other cases (eg virt-inspector)
you'd just see fewer installed packages in the <applications> list.

Since verifying package signatures is not essential for inspection,
disable this feature in librpm.

Reported-by: Xiaodai Wang
Thanks: Panu Matilainen
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2064182
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
2022-03-15 11:00:08 +00:00
Richard W.M. Jones
1b61ad0d3f Version 1.48.0. 2022-03-14 13:38:28 +00:00
Richard W.M. Jones
5bb4323fa2 docs/guestfs-release-notes-1.48.pod: Add fixed bugs to release notes
Updates: commit 2f4fb09de3
2022-03-12 22:48:42 +00:00
Richard W.M. Jones
466e7d3be3 docs: Show only libguestfs bugs in bugs-in-changelog.sh
Taken from commit ae8ff236ab.
2022-03-10 16:00:59 +00:00
Richard W.M. Jones
363c5af844 docs: Various fixes to bugs-in-changelog.sh
This script is used to prepare the list of fixed bugs for release
notes.  This commit contains miscellaneous fixes:

 - Recognise other bug formats such as direct links.

 - Ensure user is logged in so that BZ API doesn't silently truncate
   results.

(cherry picked from virt-v2v commit fac1e4fce0d7114bd044b274788de01569089e18)
2022-03-10 16:00:53 +00:00
Richard W.M. Jones
2a8a0672c4 Revert "bugs-in-changelog.sh: Various fixes to cope with new changelog format"
I fixed this in a better way in virt-v2v, so revert this change and
(next commit) use the virt-v2v commit instead.

This reverts commit ae8ff236ab.
2022-03-10 16:00:35 +00:00
Richard W.M. Jones
96a887a9bf docs: Update release notes for 1.48
Updates: commit 2f4fb09de3
2022-03-10 10:14:06 +00:00
Richard W.M. Jones
4256737227 lib: Remove drive hotplugging support
This was a feature that allowed you to add drives to the appliance
after launching it.  It was complicated to implement, and only worked
for the libvirt backend (not "direct", which is the default backend).

It also turned out to be a bad idea.  The original concept was that
appliance creation was slow, so to examine multiple guests you should
launch the handle once then hot-add the disks from each guest in turn
to manipulate them.  However this is terrible from a security point of
view, especially for multi-tenant, because the drives from one guest
might compromise the appliance and thus the filesystems/drives from
subsequent guests.

It also turns out that hotplugging is very slow.  Nowadays appliance
creation should be faster than hotplugging.

The main use case for this was virt-df, but virt-df no longer uses it
after we discovered the problems outlined above.
2022-03-09 09:28:02 +00:00
Richard W.M. Jones
55be87367d lib: Remove 9p APIs
These APIs were an experimental feature for passing through 9p
filesystems from the host to the libguestfs appliance.  It was never
possible to use this without hacking the qemu command line of the
appliance to add such drives by hand.  It also didn't fit the
libguestfs model very well.  And 9p is generally deprecated in
upstream qemu.

Note that for ABI reasons these APIs are not actually removed, they
have been changed so that they always return an error.  These APIs
were actually hard-removed from all versions of RHEL.

See-also: https://bugzilla.redhat.com/921710
2022-03-09 09:28:02 +00:00
Richard W.M. Jones
b9b0a90487 lib: Remove User-Mode Linux
User-Mode Linux was an alternative hypervisor that could run the
appliance, instead of using qemu.  It had many limitations including
lack of network, and UML support in Linux has been semi-broken for a
long time.  It was also slower than KVM on baremeal in general and had
various corner cases which were much slower including the emulated
serial port which made bulk uploads and downloads painful.  Also of
course it lacked qemu-specific features like qcow2 or any
network-backed disk, so many disk images could not be opened this way.

This was never supported in RHEL.

See-also: https://bugzilla.redhat.com/1144197
2022-03-09 09:28:02 +00:00
Richard W.M. Jones
dbc2fd8dc8 lib: Remove libguestfs live
This experimental feature allowed you (in theory) to connect to an
existing instance of the libguestfs daemon.  (Again, in theory) it
allowed you to attach to running guests.  This didn't work well in
practice.  If you want to do this, install qemu-guest-agent inside
your guest instead.

This also disables the --live options in guestfish and guestmount.
(The option now prints an error).

This was never supported in RHEL.

The daemon tests relied on this connection method to perform tests on
a bare daemon, so this removes those tests.  They were not especially
valuable.

See-also: https://bugzilla.redhat.com/798980
2022-03-09 09:27:19 +00:00
Richard W.M. Jones
aeb8286e60 Version 1.47.4. 2022-03-08 14:21:06 +00:00
Richard W.M. Jones
05561db5f6 po: Update PO files because of small change in common/ subdirectory 2022-03-08 12:26:09 +00:00
Richard W.M. Jones
1fb3aff908 tests: Fix tests which could use conflicting filenames
Commit 6d32773e81 ("tests: Run the tests in parallel.") makes all of
the tests run in the same directory.  Previously tests expected to be
run in their own subdirectories and so were freer about using generic
filenames.  When run in parallel these filenames now clash.  Fix
another case.

Fixes: commit 6d32773e81
2022-03-08 12:26:09 +00:00
Richard W.M. Jones
1b365bc605 tests: Fix TESTS continuation and duplicate EXTRA_DIST
Commit 6d32773e81 ("tests: Run the tests in parallel.") combined
multiple Makefiles into one.  During this conversion I accidentally
made several mistakes - duplicating the EXTRA_DIST entry for
mountable/test-mountable-inspect.sh and omitting the backslash
continuation of the TESTS line.

Fixes: commit 6d32773e81
2022-03-08 12:26:09 +00:00
Richard W.M. Jones
2f4fb09de3 docs: Add preliminary release notes for 1.48 2022-03-08 12:26:09 +00:00
Richard W.M. Jones
25ddaefb03 docs: Recreate guestfs-release-notes(1) page
Commit e9eaf4d889 ("docs: Split release notes by release.")  split the
old guestfs-release-notes(1) page by release, but left now-broken
links to guestfs-release-notes(1) in various places in the
documentation.

The easiest way to fix this is to recreate this page by renaming
guestfs-release-notes-historical(1) as guestfs-release-notes(1) and
adding links to the other release notes pages.

Fixes: commit e9eaf4d889
2022-03-08 11:05:04 +00:00
Laszlo Ersek
beba88e75b Update common submodule
$ git shortlog 2d8c0f8d40b5..60efc5407552

Laszlo Ersek (3):
      options: assume GUESTFS_HAVE_LUKS_UUID and GUESTFS_HAVE_CRYPTSETUP_OPEN
      options: remove stale comment about GUESTFS_CRYPTSETUP_OPEN_READONLY
      options: allocate the decrypted LUKS device name dynamically

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
2022-03-01 17:42:03 +01:00
Richard W.M. Jones
7d19cf66f2 Version 1.47.3. 2022-03-01 11:11:57 +00:00
Richard W.M. Jones
a8c4c4fc23 valgrind: Add suppression for dlopen in glibc 2.35
See: f6409b4137
2022-03-01 11:07:54 +00:00
Richard W.M. Jones
e74656a134 valgrind: Modify suppressions for extra stack frame
When running the OCaml bytecode tests, small but apparently
unimportant differences in the stack frames caused the existing
suppressions not to match.  Adding an extra "..." will ignore these
differences allowing the tests to pass.

Valgrind output before this commit (note "UnknownInlinedFun" frame):

==1733400== 79 (48 direct, 31 indirect) bytes in 1 blocks are definitely lost in loss record 320 of 518
==1733400==    at 0x484A464: calloc (vg_replace_malloc.c:1328)
==1733400==    by 0x59685D0: g_malloc0 (gmem.c:136)
==1733400==    by 0x531BB59: virClassNew (virobject.c:191)
==1733400==    by 0x553A3BF: UnknownInlinedFun (datatypes.c:110)
==1733400==    by 0x553A3BF: virDataTypesOnce (datatypes.c:121)
==1733400==    by 0x49EA0C8: __pthread_once_slow (pthread_once.c:116)
==1733400==    by 0x53312E9: virOnce (virthread.c:44)
==1733400==    by 0x553A74A: UnknownInlinedFun (datatypes.c:121)
==1733400==    by 0x553A74A: virGetConnect (datatypes.c:133)
==1733400==    by 0x54FA94F: virConnectOpenInternal (libvirt.c:895)
==1733400==    by 0x54FB883: virConnectOpenAuth (libvirt.c:1277)
==1733400==    by 0x50E842A: guestfs_int_open_libvirt_connection.constprop.0 (libvirt-auth.c:224)
==1733400==    by 0x50C6120: launch_libvirt.lto_priv.0 (launch-libvirt.c:390)
==1733400==    by 0x5040E30: UnknownInlinedFun (launch.c:114)
==1733400==    by 0x5040E30: guestfs_launch (actions-3.c:513)
==1733400==
==1733400== 256 bytes in 1 blocks are definitely lost in loss record 481 of 518
==1733400==    at 0x484586F: malloc (vg_replace_malloc.c:381)
==1733400==    by 0x137A0E: UnknownInlinedFun (memory.c:824)
==1733400==    by 0x137A0E: caml_executable_name (unix.c:367)
==1733400==    by 0x14C224: UnknownInlinedFun (startup_byt.c:502)
==1733400==    by 0x14C224: caml_main (startup_byt.c:457)
==1733400==    by 0x11CEE1: main (main.c:41)
2022-03-01 10:50:09 +00:00
Laszlo Ersek
b6ef56187f TODO: remove "Better support for encrypted devices"
LUKS support used to work best if the LUKS device resided on a partition,
and contained a Physical Volume for an LVM Volume Group. This scheme, also
called LVM-on-LUKS, is commonly created by installers of various Linux
distributions. (See RHBZ#1451665.)

Libguestfs now also supports the scheme wherein the LUKS device resides on
an LVM Logical Volume, and contains a filesystem. This is called
LUKS-on-LVM, it is the inverse of the above scheme, and is created by
installers of other Linux distributions. (See RHBZ#1658126.)

Both schemes are now decrypted by libguestfs-based utilities when
inspection is enabled (such as in "guestfish -i", virt-inspector,
virt-v2v), through the inspect_mount() function in utilities written in C,
and through the "inspect_decrypt" function in ones written in OCaml.

We don't seem to need an API like "list-luks-devices", as
"list-dm-devices" returns decrypted (i.e., opened) LUKS devices too; for
example, in the LUKS-on-LVM case:

> ><fs> list-dm-devices
> /dev/mapper/luks-0d619854-ccd5-43b1-8883-991fec5ef713
> /dev/mapper/luks-4e9e7a6f-a68c-42fd-92b4-8f4f2579a389

Thus, the subject TODO section is now out of date, and it's unclear what
remains "to do" there; let's just remove the section.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1658126
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220223162120.16729-4-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2022-02-28 13:12:25 +01:00
Laszlo Ersek
3221133140 tests: add LUKS-on-LVM test
Create a new (fake) Fedora disk image with two partitions. /dev/sda1 is
the boot partition as usual, /dev/sda2 is used as an LVM PV. The VG has
four LVs, Root and LV1 through LV3.

Each LV holds a LUKS device (with a different key). Each decrypted LUKS
device holds an ext2 filesystem, with "/dev/mapper/Root-luks" holding the
root filesystem.

Each filesystem has a dedicated label (ROOT, LV1, LV2, LV3).

In the test case, run guestfish in inspector mode, twice.

In the first invocation, provide the LUKS passphrases by LV name. Also
specific to the first invocation, fetch the LUKS UUIDs by LV name.

In the second invocation, provide the LUKS passphrases by UUID.

In both invocations, after decryption, check the filesystem labels, the
/dev/mapper/* names generated for the decrypted LUKS block devices, and
the existence of "/etc/fedora-release" on the root filesystem.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1658126
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220223162120.16729-3-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2022-02-28 13:12:21 +01:00
Laszlo Ersek
39a5bb6fda tests: rename "luks" to "lvm-on-luks"
Clarify that our current usage of "luks" stands for "lvm-on-luks" (IOW,
that the decrypted LUKS devices are Physical Volumes for LVM).

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1658126
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220223162120.16729-2-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2022-02-28 13:11:56 +01:00
Laszlo Ersek
ed7e3462a2 Update common submodule
$ git shortlog 41126802097f..2d8c0f8d40b5

Laszlo Ersek (2):
      options: extract & refactor decryption of mountables (partitions)
      options: decrypt LUKS-on-LV devices

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
2022-02-28 13:08:43 +01:00
Laszlo Ersek
b92c026ddb md-create: specify that the "chunk" parameter should be absent for RAID1
Recently, mdadm has started (correctly) rejecting the "chunk" parameter
for RAID1; see e.g. <https://bugzilla.redhat.com/show_bug.cgi?id=1987170>.
Update the documentation accordingly, and in the mdadm test case, move the
"chunk:65536" parameter from a RAID1 creation command to a RAID5 one.

Suggested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220217142944.8213-1-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2022-02-17 16:06:14 +01:00
Laszlo Ersek
19cc3dbcc4 Update common submodule
$ git shortlog 5b5fac3e0b10..41126802097f

Laszlo Ersek (3):
      Demote "Std_utils.wrap" to an internal function in Tools_utils
      Tools_utils.wrap: only wrap text for TTYs
      add common ("standard") option --wrap

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
2022-02-15 09:55:48 +01:00
Richard W.M. Jones
0553f90462 Update common submodule 2022-01-17 16:24:44 +00:00
Richard W.M. Jones
f019cc01b0 lib: Better handling for problems creating the socket path
GCC 12 gives a warning about our previous attempt to check the length
of the socket path.  In the ensuing discussion it was pointed out that
it is easier to get snprintf to do the hard work.  snprintf will
return an int >= UNIX_PATH_MAX if the path is too long, or < 0 if
there are other errors such as locale/encoding problems.  So we should
just check for those two cases instead.

https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/NPKWMTSJ2A2ABNJJEH6WTZIAEFTX6CQY/

Thanks: Martin Sebor and Laszlo Ersek
2022-01-17 15:50:36 +00:00
Richard W.M. Jones
d1e7e1a323 Version 1.47.2. 2021-12-24 10:08:03 +00:00
Laszlo Ersek
5858c2cf6c launch-libvirt: add virtio-net via the standard <interface> element
Starting with version 3.8.0, libvirt allows us to specify the network
address and network mask (as prefix) for SLIRP directly via the
<interface> element in the domain XML:
<https://libvirt.org/formatdomain.html#userspace-slirp-stack>. This means
we don't need the <qemu:commandline> hack for virtio-net on such versions.

Restrict the hack in construct_libvirt_xml_qemu_cmdline() to
libvirt<3.8.0, and generate the proper <interface> element in
construct_libvirt_xml_devices() on libvirt>=3.8.0.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2034160
Suggested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20211223103701.12702-4-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
2021-12-23 13:22:38 +01:00
Laszlo Ersek
216de164e0 lib: extract NETWORK_ADDRESS and NETWORK_PREFIX as macros
The 169.254.0.0/16 network specification (for the appliance) is currently
duplicated between the direct backend and the libvirt backend. In a
subsequent patch, we're going to need the network specification in yet
another spot; extract it now to the NETWORK_ADDRESS and NETWORK_PREFIX
macros (simply as strings).

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2034160
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20211223103701.12702-3-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
2021-12-23 13:22:35 +01:00
Laszlo Ersek
5ce5ef6a97 launch-libvirt: place our virtio-net-pci device in slot 0x1e
The <qemu:commandline> trick we use for adding our virtio-net-pci device
in the libvirt backend can conflict with libvirtd's and QEMU's PCI address
assignment. Try to mitigate that by placing our device in slot 0x1e on the
root bus. In practice this could only conflict with a "dmi-to-pci-bridge"
device model, which libvirtd itself places in slot 0x1e. However, given
the XMLs we generate, and modern QEMU versions, libvirtd has no reason to
auto-add "dmi-to-pci-bridge". Refer to
<https://libvirt.org/formatdomain.html#controllers>.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2034160
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20211223103701.12702-2-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
2021-12-23 13:22:14 +01:00
Richard W.M. Jones
4af6d68e2d fish: Avoid valgrind test from creating fish/.cache
Work around for https://bugzilla.redhat.com/show_bug.cgi?id=2031135
2021-12-10 16:18:03 +00:00
Richard W.M. Jones
c6b25262ee valgrind: Update suppressions list
For OCaml 4.13, libvirt 7.7.
2021-12-10 14:53:43 +00:00
Richard W.M. Jones
1941593585 Disable OCaml warning 6 completely
Warning 6 "labels-omitted" is not useful.  It's fine to omit labels on
positional arguments.

Example:

  File "perl_edit.ml", line 30, characters 2-13:
  30 |   c_edit_file (verbose ()) g (Guestfs.c_pointer g) file expr
         ^^^^^^^^^^^
  Warning 6 [labels-omitted]: label verbose was omitted in the application of this function.

The function is specified as:

  external c_edit_file : verbose:bool -> Guestfs.t -> int64 -> string -> string -> unit

The complaint is that the verbose: label has been omitted from the
first argument when the function is called, but IMO this is a
stylistic thing, not a bug.

(cherry picked from
guestfs-tools commit 577f7aee4b1c720f4c4826115b49a0c3870b149e)
2021-12-10 10:30:17 +00:00
Richard W.M. Jones
0d05a229f3 customize: Suppress OCaml warning
In OCaml 4.13:

File "perl_edit.ml", line 30, characters 2-13:
30 |   c_edit_file (verbose ()) g (Guestfs.c_pointer g) file expr
       ^^^^^^^^^^^
Error (warning 6 [labels-omitted]): label verbose was omitted in the application of this function.

(cherry picked from
guestfs-tools commit a4930f5fad82e5358d565b8cf3610970e9646259)
2021-12-10 10:30:11 +00:00
Richard W.M. Jones
b64e9bffc1 generator: Replace more "noalloc" with [@@noalloc]
In some places in the generator we were still generating "noalloc".
It was hidden from the previous regexp I used to replace these because
of string escaping.

Updates: commit a69cde79ca
2021-12-10 09:58:12 +00:00
Richard W.M. Jones
1e60550c2a Update common submodule
Picks up this commit:

    mlstdutils/std_utils.mli: Remove export of deprecated String.copy

    Since OCaml strings are at long last immutable, the String.copy
    function is deprecated.  Stop exporting it from our Std_utils.String.
    Any places we use it are wrong and should be fixed.
2021-12-10 09:55:51 +00:00
Neil Hanlon
631962c0e8 Add detection support for Rocky Linux (CentOS/RHEL-like)
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2030709
Thanks: label@rockylinux.org

---

RWMJ notes: I fixed the original patch so it compiled.  This patch
sets osinfo to "rocky8", which doesn't exist in the osinfo db yet.
Arguably we might want to set this to "centos8", but we can see what
libosinfo decides to do.  Here is partial virt-inspector output on a
Rocky Linux disk image:

$ ./run virt-inspector -a disk.img
<?xml version="1.0"?>
<operatingsystems>
  <operatingsystem>
    <root>/dev/rl/root</root>
    <name>linux</name>
    <arch>x86_64</arch>
    <distro>rocky</distro>
    <product_name>Rocky Linux 8.5 (Green Obsidian)</product_name>
    <major_version>8</major_version>
    <minor_version>5</minor_version>
    <package_format>rpm</package_format>
    <package_management>dnf</package_management>
    <hostname>localhost.localdomain</hostname>
    <osinfo>rocky8</osinfo>
    <mountpoints>
      <mountpoint dev="/dev/rl/root">/</mountpoint>
      <mountpoint dev="/dev/sda1">/boot</mountpoint>
    </mountpoints>
    <filesystems>
      <filesystem dev="/dev/rl/root">
        <type>xfs</type>
        <uuid>fed8331f-9f25-40cd-883e-090cd640559d</uuid>
      </filesystem>
      <filesystem dev="/dev/rl/swap">
        <type>swap</type>
        <uuid>6da2c121-ea7d-49ce-98a3-14a37fceaadd</uuid>
      </filesystem>
      <filesystem dev="/dev/sda1">
        <type>xfs</type>
        <uuid>4efafe61-2d20-4d93-8055-537e09bfd033</uuid>
      </filesystem>
    </filesystems>
2021-12-10 09:09:47 +00:00
Richard W.M. Jones
d6773c102d Version 1.47.1. 2021-12-09 17:26:05 +00:00
Richard W.M. Jones
90eb3a4184 lib, lua: Fix usage of strerror_r
$ ./run guestfish -vx add-drive foo "readonly:true"
  libguestfs: trace: set_pgroup true
  libguestfs: trace: set_pgroup = 0
  libguestfs: trace: add_drive "foo" "readonly:true"
  libguestfs: error: foo:
  libguestfs: trace: add_drive = -1 (error)
  libguestfs: trace: close
  libguestfs: closing guestfs handle 0x55c0bacf12a0 (state 0)

Fix the usage of strerror_r by using the new wrapper defined in
libguestfs-common.  A similar fix is made in the Lua bindings.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2030396
Reported-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Tested-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2021-12-09 13:46:28 +00:00
Laszlo Ersek
d829f9ff9a daemon/listfs: don't call "sgdisk -i" on bogus MBR partition table entry
The "is_partition_can_hold_filesystem" function calls
"Parted.part_get_gpt_type" on the partition if:
- the partition table type is GPT,
- or the partition table type is MBR, and the partition is primary or
  logical.

The one entry in the fake MBR partition table described in the previous
patch passes the second branch of this check, therefore
"Parted.part_get_gpt_type" is reached, and it invokes "sgdisk -i 1" on the
disk.

Surprisingly (not), while "sgdisk -i" copes fine with valid MBR partition
tables, it chokes on the fake one. The output does not contain the
"Partition GUID code" line, and so "sgdisk_info_extract_field" throws an
exception.

Prevent calling "Parted.part_get_gpt_type" on a bogus MBR partition table,
similarly to the "extended entry in MBR partition table" case; the
difference is that the bogus primary entry, unlike a valid extended entry,
*can* hold a filesystem.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1931821
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
Message-Id: <20211125094954.9713-6-lersek@redhat.com>
2021-11-26 10:17:54 +01:00
Laszlo Ersek
edfebee404 daemon/parted: work around part table type misreporting by "parted"
"parted" incorrectly reports "loop" rather than "msdos" for the partition
table type, when the (fake) partition table comes from the "--mbr" option
of "mkfs.fat" (in dosfstools-4.2+), and the FAT variant in question is
FAT16 or FAT32. (See RHBZ#2026224.) Work this around by
- parsing the partition table ourselves, and
- overriding "loop" with "msdos" when appropriate.

Note that when the FAT variant is FAT12, "parted" fails to parse the fake
MBR partition table completely (see RHBZ#2026220), which we cannot work
around. However, FAT12 should be a rare corner case in libguestfs usage --
"mkfs.fat" auto-chooses FAT12 only below 9MB disk size, and even "-F 12"
can only be forced up to and including 255MB disk size.

Add the helper function "has_bogus_mbr" to the Utils module; we'll use it
elsewhere too.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1931821
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
Message-Id: <20211125094954.9713-5-lersek@redhat.com>
[lersek@redhat.com: drop "fun" keyword, and use partial application, in
 the definition of "sec0at" [Rich]]
2021-11-26 10:17:05 +01:00
Laszlo Ersek
c33c2a1d13 daemon/parted: simplify print_partition_table() prototype
Since commit 994ca1f8eb ("daemon: Reimplement 'part_get_mbr_part_type'
API in OCaml.", 2018-05-02), we've not had any calls to
print_partition_table() that would pass a "false" argument for the
"add_m_option" parameter.

Remove the parameter, and inside part_get_mbr_part_type(), remove the dead
branch.

Relatedly, update the comment on the
"print_partition_table_machine_readable" OCaml function, originally from
commit 32e661f421 ("daemon: Reimplement ‘part_list’ API in OCaml.",
2017-07-27). Because print_partition_table() now passes "-m" to "parted"
unconditionally, and there are no use cases left that would *forbid* "-m",
"print_partition_table_machine_readable" is almost equivalent to
print_partition_table() -- modulo the enforcement of the "BYT;" header.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
Message-Id: <20211125094954.9713-4-lersek@redhat.com>
2021-11-26 10:16:06 +01:00
Laszlo Ersek
e3671362af daemon/9p: fix wrong pathname in error message
The directory that readdir() and closedir() work on is BUS_PATH
("/sys/bus/virtio/drivers/9pnet_virtio"), not "/sys/block". Fix the error
messages that are sent when readdir() or closedir() fails.

(The invalid "sys/block" pathname could be a leftover from when the
directory reading logic was (perhaps) copied from "daemon/sync.c".)

Fixes: 5f10c33503
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
Message-Id: <20211125094954.9713-3-lersek@redhat.com>
2021-11-26 10:16:05 +01:00
Laszlo Ersek
0ab9305055 daemon/mkfs: disable creation of fake MBR partition table with "mkfs.fat"
Search the usage output of "mkfs.fat" for "--mbr[="; cache the result for
further invocations. If the option is supported, pass "--mbr=n" to
"mkfs.fat". This will prevent the creation of a bogus partition table
whose first (and only) entry describes a partition that contains the
partition table.

(Such a bogus partition table breaks "parted", which is a tool used by
libguestfs extensively, both internally and in public libguestfs APIs.)

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1931821
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
Message-Id: <20211125094954.9713-2-lersek@redhat.com>
2021-11-26 10:16:05 +01:00
Richard W.M. Jones
e7f72ab146 xfs: Document lazy-counters setting cannot be changed in XFS version 5
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2024022
2021-11-22 15:11:20 +00:00
Richard W.M. Jones
9fda9110e6 Update common submodule
Removes old compat Bytes module.

Fixes: commit b536c61a6d
Thanks: Laszlo Ersek
2021-11-12 14:02:04 +00:00
Richard W.M. Jones
4fe8df48a7 tests/gdisk/test-expand-gpt.pl: Don't race with other tests
Another test was removing all disk_*.img files, which removed the file
used by this test.  This was ultimately caused by us using parallel
tests.

Put the disk image files back into the tests/gdisk/ subdirectory to
avoid this race.

Fixes: commit 6d32773e81
2021-11-09 11:49:06 +00:00
Richard W.M. Jones
30a3c72d51 tests/gdisk/test-expand-gpt.pl: Don't hide error message from qemu-img resize
In a test I ran qemu-img resize failed.  However because we redirected
stderr to /dev/null the error message was hidden.
2021-11-09 11:37:54 +00:00
Richard W.M. Jones
5da2b9f130 tests/gdisk/test-expand-gpt.pl: Fix some warnings
"my" variable $output masks earlier declaration in same scope at ./gdisk/test-expand-gpt.pl line 73.
"my" variable $end_sectors masks earlier declaration in same scope at ./gdisk/test-expand-gpt.pl line 78.
2021-11-09 11:36:50 +00:00
Richard W.M. Jones
60e9232f4e Move minimum OCaml version to 4.04.
Synchronize with common module which also requires 4.04.

Small adjustment to use of List.sort_uniq because the signature
changed slightly.
2021-11-09 10:21:30 +00:00
Richard W.M. Jones
a69cde79ca daemon: Replace "noalloc" with [@@noalloc] 2021-11-09 10:20:37 +00:00
Richard W.M. Jones
b536c61a6d m4: Remove test for OCaml Bytes module 2021-11-09 10:07:00 +00:00
Richard W.M. Jones
760d11ecfa rust: Use distclean to clean cache rather than make clean
Actually cargo caches downloaded libraries.  The previous change
caused cargo to download and rebuild these after make clean which is
overly aggressive.  Use make distclean instead.

Updates: commit 1834f19d20
2021-10-21 14:36:41 +01:00
Richard W.M. Jones
1834f19d20 rust: Wire up make clean so it runs cargo clean
Before this commit, after make clean:

$ du -sh rust
641M	rust

After:

776K	rust
2021-10-20 17:55:19 +01:00
Laszlo Ersek
305b02e7e7 daemon: inspection: Add support for Kylin (RHBZ#1995391).
Similar-to: cd08039d24
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20211013163023.21786-1-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2021-10-14 19:49:56 +02:00
Laszlo Ersek
f34bd6b12f build, docs: spell out minimum version (4.0.0) for the (optional) Yara lib
Commit e597fc5317 ("daemon/yara: fix undefined behavior due to Yara 4.0
API changes", 2021-10-12) prevents the daemon from using such a Yara
version that precedes 4.0.0.

If only yara < 4 is found, treat the library as absent, rather than
attempting and failing to compile the yara module of the daemon. Note the
version requirement in the documentation too.

Suggested-by: Eric Blake <eblake@redhat.com>
Suggested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20211013133611.21599-4-lersek@redhat.com>
Acked-by: Eric Blake <eblake@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2021-10-14 19:45:07 +02:00
Laszlo Ersek
4daec34a01 build: eliminate the AC_CHECK_LIB / AC_CHECK_HEADER tests for Yara
Eliminate the AC_CHECK_LIB / AC_CHECK_HEADER tests for Yara, for the
following reasons:

- Upstream Yara has provided a pkg-config file since 2015, so the
  (now-fixed) pkg-config check should always find it, without the
  AC_CHECK_LIB / AC_CHECK_HEADER fallback branch.

- In a subsequent patch, we'll want to test for the incompatible Yara API
  changes described at
  <https://github.com/VirusTotal/yara/wiki/Backward-incompatible-changes-in-YARA-4.0-API>.

  That's easy to do with pkg-config, but impossible with AC_CHECK_*,
  without a custom test. Namely, both AC_CHECK_DECLS and AC_CHECK_TYPES
  appear unable to check the parameter list of a function pointer typedef
  (namely YR_CALLBACK_FUNC and YR_COMPILER_CALLBACK_FUNC). And writing a
  dedicated test for this is overkill.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20211013133611.21599-3-lersek@redhat.com>
Acked-by: Eric Blake <eblake@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2021-10-14 19:45:03 +02:00
Laszlo Ersek
54187b7f98 build: fix the pkg-config identifier of the (optional) Yara library
The upstream Yara project has always provided its "libyara/yara.pc.in"
file with "Name: yara" -- ever since its introduction in commit
334bd1a671ca ("Add support for pkg-config", 2015-01-08).

In spite of this, when the (optional) Yara dependency was added to
libguestfs in commit 2e24129da3 ("appliance: add yara dependency",
2017-05-02), PKG_CHECK_MODULES was invoked with [libyara] as
list-of-modules.

(That was clearly a bug. I'm unsure what Debian calls their Yara
pkg-config module, but calling it anything else than "yara" would be a
distribution bug: upstream projects provide pkg-config files specifically
so that dependent projects can find their dependencies *regardless of
distribution*.)

As a consequence, on Fedora today, the PKG_CHECK_MODULES macro always
fails, and only the AC_CHECK_LIB / AC_CHECK_HEADER branch finds Yara.

In a subsequent patch, we'll want to add a version requirement to the
PKG_CHECK_MODULES macro invocation, so at first, fix the pkg-config
identifier of Yara.

Fixes: 2e24129da3
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20211013133611.21599-2-lersek@redhat.com>
Acked-by: Eric Blake <eblake@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2021-10-14 19:44:31 +02:00
Laszlo Ersek
e597fc5317 daemon/yara: fix undefined behavior due to Yara 4.0 API changes
Currently, the Yara test case ("yara/test-yara-scan.sh") fails, with the
following obscure error message:

> ><fs> yara-scan /text.txt
> libguestfs: error: deserialise_yara_detection_list:

Namely, the Yara rule match list serialization / de-serialization, between
the daemon and the library, is broken. It is caused by the following
incompatible pointer passing (i.e., undefined behavior), in function
do_internal_yara_scan(), file "daemon/yara.c":

>   r = yr_rules_scan_fd (rules, fd, 0, yara_rules_callback, (void *) path, 0);
                                        ^^^^^^^^^^^^^^^^^^^

The prototype of yara_rules_callback() is:

> static int
> yara_rules_callback (int code, void *message, void *data)

however, in Yara commit 2b121b166d25 ("Track string matches using
YR_SCAN_CONTEXT.", 2020-02-27), which was included in the upstream v4.0.0
release, the rules callback prototype was changed as follows:

> diff --git a/libyara/include/yara/types.h b/libyara/include/yara/types.h
> index cad095cd70c2..f415033c4aa6 100644
> --- a/libyara/include/yara/types.h
> +++ b/libyara/include/yara/types.h
> @@ -661,6 +644,7 @@ struct YR_MEMORY_BLOCK_ITERATOR
>
>
>  typedef int (*YR_CALLBACK_FUNC)(
> +    YR_SCAN_CONTEXT* context,
>      int message,
>      void* message_data,
>      void* user_data);

Therefore, the yara_rules_callback() function is entered with a mismatched
parameter list in the daemon, and so it passes garbage to
send_detection_info(), for serializing the match list.

This incompatible change was in fact documented by the Yara project:

  https://github.com/VirusTotal/yara/wiki/Backward-incompatible-changes-in-YARA-4.0-API#scanning-callback

Gcc too warns about the incompatible pointer type, under
"-Wincompatible-pointer-types". However, libguestfs is built without
"-Werror" by default, so the warning is easy to miss, and the bug only
manifests at runtime.

(The same problem exists for yr_compiler_set_callback() /
compile_error_callback():

  https://github.com/VirusTotal/yara/wiki/Backward-incompatible-changes-in-YARA-4.0-API#compiler-callback

except that this instance of the problem is not triggered by the test
case, as the rule list always compiles.)

Rather than simply fixing the parameter lists, consider the following
approach.

If Yara's YR_CALLBACK_FUNC and YR_COMPILER_CALLBACK_FUNC typedefs were not
for *pointer* types but actual *function* prototypes, then we could use
them directly in the declarations of our callback functions. Then any
future changes in the param lists would force a "conflicting types"
*compilation error* (not a warning). Illustration:

  /* this is *not* a pointer type */
  typedef int HELLO_FUNC (void);

  /* function declarations */
  static HELLO_FUNC my_hello_good;
  static HELLO_FUNC my_hello_bad;

  /* function definition, with explicit parameter list */
  static int my_hello_good (void) { return 1; }

  /* function definition with wrong param list -> compilation error */
  static int my_hello_bad (int i) { return i; }

Unfortunately, given that the Yara-provided typedefs are already pointers,
we can't do this, in standard C anyway. Type derivation only allows for
array, structure, union, function, and pointer type derivation; it does
not allow "undoing" previous derivations.

However, using gcc's "typeof" keyword, the idea is possible. Given
YR_CALLBACK_FUNC, the expression

  (YR_CALLBACK_FUNC)NULL

is a well-defined null pointer, and the function designator expression

  *(YR_CALLBACK_FUNC)NULL

has the desired function type.

Of course, evaluating this expression would be undefined behavior, but in
the GCC extension expression

  typeof (*(YR_CALLBACK_FUNC)NULL)

the operand of the "typeof" operator is never evaluated, as it does not
have a variably modified type. We can therefore use this "typeof" in the
same role as HELLO_FUNC had in the above example.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20211011223627.20856-4-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
[lersek@redhat.com: clean up whitespace in "YR_RULE *rule"]
2021-10-12 16:48:04 +02:00
Laszlo Ersek
98ed0243e7 lib/proto: suppress "may be used uninitialized" in send_file_complete()
gcc emits the following warning:

> proto.c: In function ‘send_file_complete’:
> proto.c:437:10: error: ‘buf’ may be used uninitialized
> [-Werror=maybe-uninitialized]
>   437 |   return send_file_chunk (g, 0, buf, 0);
>       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In theory, passing the 1-byte array "buf", with indeterminate contents, to
xdr_bytes() ultimately, could be fine -- assuming xdr_bytes() never reads
the contents of the buffer, due to the buffer size being zero. However,
the xdr_bytes() manual does not seem to guarantee this (it also does not
explicitly permit passing a NULL buffer alongside size=0, which would be
even simpler for the caller).

In order to shut up the compiler, just zero-initialize the buffer --
that's simpler than adding diagnostics pragmas. The "maybe-uninitialized"
warning is otherwise very useful, so keep it globally enabled (per
WARN_CFLAGS / WERROR_CFLAGS).

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20211011223627.20856-3-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2021-10-12 16:48:01 +02:00
Laszlo Ersek
7915938b8e build: fix typo in "--enable-werror" help string
While <https://libguestfs.org/guestfs-building.1.html> correctly documents
the "--enable-werror" option, the "./configure" help text itself doesn't.
Replace "--enable-error" with "--enable-werror" now.

Fixes: 0f54df53d2
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20211011223627.20856-2-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2021-10-12 16:47:37 +02:00
Richard W.M. Jones
63c9cd933a m4/guestfs-ocaml.m4: Fix deprecated warning format
In OCaml 4.13:

Alert ocaml_deprecated_cli: Setting a warning with a sequence of lowercase or uppercase letters,
like 'CDEFLMPSUVYZX', is deprecated.
Use the equivalent signed form: +C+D+E+F+L+M+P+S+U+V+Y+Z+X+52-3.

(cherry picked from
guestfs-tools commit fa4f59e1d99c08d7e0bae2a7cb54f254a6506d67)
2021-10-05 21:08:07 +01:00
Laszlo Ersek
3f6f2fb8f6 daemon/inspect_fs_unix: recognize modern Pardus GNU/Linux releases
Recent Pardus releases seem to have abandoned the original
"/etc/pardus-release" file, which the current Pardus detection, from
commit 233530d354 ("inspect: Add detection of Pardus.", 2010-10-29), is
based upon.

Instead, Pardus apparently adopted the "/etc/os-release" specification
<https://www.freedesktop.org/software/systemd/man/os-release.html>, with
"ID=pardus". Extend the "distro_of_os_release_id" function accordingly.
Keep the original method for recognizing earlier releases.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1993842
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20211001125338.8956-1-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2021-10-01 15:34:25 +02:00
Laszlo Ersek
e2f8db27d0 Go bindings: fix "C array of strings" -- char** -- allocation
The current "arg_string_list" and "free_string_list" implementations go
back to commit b6f01f3260 ("Add Go (language) bindings.", 2013-07-03).
There are two problems with them:

- "free_string_list" doesn't actually free anything,

- at the *first* such g.Internal_test() call site that passes an
  Ostringlist member inside the Optargs argument, namely:

> g.Internal_test ("abc",
>                  string_addr ("def"),
>                  []string{},
>                  false,
>                  0,
>                  0,
>                  "123",
>                  "456",
>                  []byte{'a', 'b', 'c', '\000', 'a', 'b', 'c'},
>                  &guestfs.OptargsInternal_test{Ostringlist_is_set: true,
>                                                Ostringlist: []string{}
>                                               }
>                 )

  the "golang/run-bindtests" case crashes:

> panic: runtime error: cgo argument has Go pointer to Go pointer
>
> goroutine 1 [running]:
> libguestfs.org/guestfs.(*Guestfs).Internal_test.func7(0xc000018180,
> 0xadfb60, 0xadfb80, 0xc000010048, 0x0, 0x0, 0x0, 0xae3e10, 0xae3e30,
> 0xade3a0, ...)
>         golang/src/libguestfs.org/guestfs/guestfs.go:6729 +0xa9
> libguestfs.org/guestfs.(*Guestfs).Internal_test(0xc000018180, 0x4ee3a5,
> 0x3, 0xc000061be8, 0xc000061af8, 0x0, 0x0, 0xc000061a00, 0x0, 0x0, ...)
>         golang/src/libguestfs.org/guestfs/guestfs.go:6729 +0x3c9
> main.main()
>         golang/bindtests/bindtests.go:77 +0x151e
> exit status 2
> FAIL run-bindtests (exit status: 1)

In Daniel P. Berrangé's words [1],

> You're allowed to pass a Go pointer to C via CGo, but the memory that
> points to is not allowed to contained further Go pointers. So the struct
> fields must strictly use a C pointer.

One pattern to solve the problem has been shown on stackoverflow [2].
Thus, rewrite the "arg_string_list" and "free_string_list" functions
almost entirely in C, following that example.

While this approach is not the most idiomatic Go, as a solution exists
without C helper functions [3], it should still be acceptable, at least as
an incremental improvement, for letting "golang/run-bindtests" pass.

[1] https://listman.redhat.com/archives/libguestfs/2021-September/msg00118.html
[2] https://stackoverflow.com/questions/35924545/golang-cgo-panic-runtime-error-cgo-argument-has-go-pointer-to-go-pointer
[3] https://listman.redhat.com/archives/libguestfs/2021-September/msg00106.html

Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "Richard W.M. Jones" <rjones@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20210921192939.32468-1-lersek@redhat.com>
Tested-by: "Richard W.M. Jones" <rjones@redhat.com>
Acked-by: "Richard W.M. Jones" <rjones@redhat.com>
2021-09-27 09:57:34 +02:00
Richard W.M. Jones
5c68392175 Version 1.46.0. 2021-09-23 14:52:46 +01:00
Richard W.M. Jones
5b432781e2 build: Remove BUGS file
Recent changes to Red Hat Bugzilla broke our ability to generate this
file.  In any case it's not very useful since a simple Bugzilla query
can be used instead:

https://bugzilla.redhat.com/buglist.cgi?component=libguestfs

Remove the file.  The generator used this file to ensure it was being
run from the correct directory and to take a lock.  Use RELEASES file
instead.

See also: https://github.com/python-bugzilla/python-bugzilla/issues/149
2021-09-23 14:52:46 +01:00
Richard W.M. Jones
ab2d624f46 docs: Finalize release notes for 1.46 release today 2021-09-23 09:44:08 +01:00
Laszlo Ersek
627f808e4b tests: xfs: remove lazy-counter disablement test
According to xfs_admin(8):

>        -c 0|1 Enable (1) or disable (0) lazy-counters in the  filesys‐
>               tem.
>
>               Lazy-counters  may  not  be  disabled  on  Version 5 su‐
>               perblock filesystems (i.e. those with metadata CRCs  en‐
>               abled).
>
>               [...]

According to mkfs.xfs(1):

>        -m global_metadata_options
>        Section Name: [metadata]
>               These  options  specify metadata format options that ei‐
>               ther apply to the entire  filesystem  or  aren't  easily
>               characterised  by  a  specific  functionality group. The
>               valid global_metadata_options are:
>
>                   [...]
>
>                    crc=value
>                           This  is  used  to create a filesystem which
>                           maintains and checks CRC information in  all
>                           metadata  objects  on disk. The value is ei‐
>                           ther 0 to disable the feature, or 1  to  en‐
>                           able the use of CRCs.
>
>                           [...]
>
>                           By  default,  mkfs.xfs  will enable metadata
>                           CRCs.

Consistently with the above, the first "xfs_admin" test case in
"generator/actions_core.ml", which attempts to disable lazy counters,
always fails:

> 534/550 test_xfs_admin_0
> libguestfs: error: xfs_admin: /dev/sda1: Cannot disable lazy-counters on V5 fs

We can resolve this test failure in three ways:

(1) Extend do_mkfs() [daemon/mkfs.c], possibly even introduce
    do_mkfs_xfs(), and permit the caller to specify "-m crc=0" for
    mkfs.xfs. Then use this option when the temporary filesystem is
    created in the XFS test that disables lazy counters.

(2) Extend the "guestfs_int_xfsinfo" structure in the libguestfs-common
    project, with an "xfs_crc" field. Extend parse_xfs_info()
    [daemon/xfs.c] to populate the field from "meta-data=...crc=[01]".
    Modify the test case to check the following post-condition:

      xfs_crc || xfs_lazycount == 0

    instead of the current

      xfs_lazycount == 0

    effectively ignoring "xfs_lazycount" when "xfs_crc" is set.

(3) Remove the test altogether that attempts to disable lazy counters
    after filesystem creation.

Given that new XFS filesystems are created with metadata CRCs enabled by
default, and several XFS features depend on metadata CRCs being enabled,
this patch implements option (3).

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20210920052335.3358-4-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2021-09-21 19:01:18 +02:00
Laszlo Ersek
24f98939ae test-md-and-lvm-devices: work around RAID0 regression in Linux v3.14/v5.4
The "test-md-and-lvm-devices" test case creates, among other things, a
RAID0 array (md127) that spans two *differently sized* block devices
(sda1: 20MB, lv0: 16MB).

In Linux v3.14, the layout of such arrays was changed incompatibly and
undetectably. If an array were created with a pre-v3.14 kernel and
assembled on a v3.14+ kernel, or vice versa, data could be corrupted.

In Linux v5.4, a mitigation was added, requiring the user to specify the
layout version of such RAID0 arrays explicitly, as a module parameter. If
the user fails to specify a layout version, the v5.4+ kernel refuses to
assemble such arrays. This is why "test-md-and-lvm-devices" currently
fails, with any v5.4+ appliance kernel.

Until we implement a more general solution (see the bugzilla link below),
work around the issue by sizing sda1 and lv0 identically. For this,
increase the size of sdb1 to 24MB: when one 4MB extent is spent on LVM
metadata, the resultant lv0 size (20MB) will precisely match the size of
sda1.

This workaround only affects sizes, and does not interfere with the
original purpose of this test case, which is to test various *stackings*
between disk partitions, software RAID (md), and LVM logical volumes.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=2005485
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20210920052335.3358-3-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
[lersek@redhat.com: remove stray empty line]
2021-09-21 19:00:59 +02:00
Laszlo Ersek
8156c16520 test-9p: fix the base directory that's exported to the guest
In commit 6d32773e81 ("tests: Run the tests in parallel.", 2021-03-18),
the "abs_srcdir" macro value that the 9p test would see changed from
".../tests/9p" to just ".../tests" -- the last component got dropped.

(Said commit updated some "abs_srcdir"-based references accordingly, for
example under "tests/disks", but "tests/9p/test-9p.sh" was missed.)

Therefore, the guest-visible location of the "/test-9p.sh" file changed to
"/9p/test-9p.sh", and a non-recursive listing of the guest-visible root
directory would not return the file. Thus, the test fails now.

Restore the host-side base directory to ".../tests/9p".

Fixes: 6d32773e81
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20210920052335.3358-2-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2021-09-21 19:00:11 +02:00
Olaf Hering
f47e0bb672 appliance: reorder mounting of special filesystems in init
Make sure proc and dev are available early.
No change in behavior intended.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2021-09-15 12:37:08 +01:00
Olaf Hering
9db0c98c99 appliance: enable bash's Process Substitution feature
bash can read input from a spawned process, and even provide input to
such process. This feature relies on /dev/fd/ being present. In the
past udev silently created this symlink, so this bash feature worked
more or less by accident. With recent systemd versions, such as 246
which is included in Leap 15.3, the symlink is not created anymore. As
a result scripts, such as /sbin/dhclient-script, fail to work
properly.

This symlink should have been created in version 1 of this variant of /init.

https://bugzilla.opensuse.org/show_bug.cgi?id=1190501

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2021-09-15 12:37:08 +01:00
Olaf Hering
c0de4de902 appliance: add reboot and netconfig for SUSE
systemd-sysvinit contains the reboot command, which is used to
properly stop the VM. This was required by other packages, and as a
result always available. Since Leap 15.3 it will not be installed, and
as a result the VM will just panic because /init died.

If the appliance is started with --network, dhclient will run
/usr/sbin/dhclient-script, which in turn may call /sbin/netconfig to
update /etc/resolv.conf. Install sysconfig-netconfig to make sure DNS
resolving actually works.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2021-09-14 20:49:02 +01:00
Richard W.M. Jones
46ab3dbbc0 docs: Prepare draft release notes for 1.46 2021-09-13 19:29:17 +01:00
Richard W.M. Jones
ae8ff236ab bugs-in-changelog.sh: Various fixes to cope with new changelog format 2021-09-13 19:29:17 +01:00
Richard W.M. Jones
e14ff93742 lib: direct: Remove use of sga
sga (or "sgabios" or "Serial Graphics Adapter") is an option ROM for
seabios which directs output to the serial adapter.  This is very
useful for debugging BIOS problems during boot.

RHEL wants to deprecate this feature (in fact, they just deprecated it
without telling us).  However there is an equivalent feature in
seabios (seabios >= 1.11 / qemu >= 2.11.0) which can be enabled using
either -nographic or -machine graphics=off

This commit removes sga and enables -machine graphics=off in the
direct backend.

References (for RHEL 9 qemu change):
https://bugzilla.redhat.com/show_bug.cgi?id=2002325
https://bugzilla.redhat.com/show_bug.cgi?id=2000845
https://lists.nongnu.org/archive/html/qemu-devel/2021-09/msg02417.html
https://listman.redhat.com/archives/libvir-list/2021-September/msg00205.html

For the libvirt backend we will continue to use <bios useserial=yes>.
This currently breaks when sga is not available, but I talked to Dan
and the plan there is to adapt libvirt so the same XML will enable
-machine graphics=off.  IOW libguestfs does not need to make any
change.

References (for libvirt change):
https://bugzilla.redhat.com/show_bug.cgi?id=2003092
https://listman.redhat.com/archives/libvir-list/2021-September/msg00193.html

Thanks: Gerd Hoffman, Daniel Berrangé
2021-09-13 10:40:50 +01:00
Laszlo Ersek
523b0180d8 daemon_utils_tests: generalize ocaml-hivex[-devel] lookup
Pass $(HIVEX_LIBS) with -cclib under the "daemon_utils_tests_LINK" target;
otherwise the OCaml compiler does not tell the linker where "-lhivex" can
be found, and the linking step fails if "-lhivex" is not on a system
library path.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20210908133542.19002-3-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2021-09-09 14:52:03 +02:00
Laszlo Ersek
53e03eefae daemon: generalize ocaml-hivex[-devel] lookup
"ocamlc -where" is supposed to "print the location of the standard library
and exit". While this directory contains core OCaml C header files, it
does not contain hivex-related C header files. Trim "guestfsd_CPPFLAGS"
accordingly.

Furthermore, the hivex module for OCaml may exist elsewhere than under the
OCaml standard library directory. Invoke "ocamlfind query hivex" to find
this module. This is what AC_CHECK_OCAML_PKG(hivex) does too, in
"m4/guestfs-ocaml.m4" and "m4/ocaml.m4".

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20210908133542.19002-2-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2021-09-09 14:52:02 +02:00
Richard W.M. Jones
ceb034c92c python, java: Avoid bogus -fanalyzer warnings
This is essentially the same as the previous OCaml commit.  It does
not fix a real bug.
2021-09-07 16:50:38 +01:00
Richard W.M. Jones
ea04d6b878 ocaml/guestfs-c.c: Avoid bogus -fanalyzer warning
This warning is bogus, caused by the analyzer cannot track that len ==
0 if roots == NULL.  I just changed the code to make it easier to
analyze, this doesn't fix any real bug.

guestfs-c.c: In function 'guestfs_finalize':
guestfs-c.c:85:9: error: dereference of NULL '0B' [CWE-476] [-Werror=analyzer-null-dereference]
   85 |         caml_remove_generational_global_root (roots[i]);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-09-07 16:45:23 +01:00
Richard W.M. Jones
a7245fba7a daemon/utils.c: Fix potential unbounded stack usage
utils.c: In function 'prog_exists':
utils.c:650:1: error: stack usage might be unbounded [-Werror=stack-usage=]
  650 | prog_exists (const char *prog)
      | ^
2021-09-07 15:55:48 +01:00
Richard W.M. Jones
58599031f8 daemon/xattr.c: Increase size of temporary buffer for %zu
Found by GCC -fanalyzer:

xattr.c:478:32: error: '%zu' directive output may be truncated writing between 1 and 19 bytes into a region of size 16 [-Werror=format-truncation=]
  478 |     snprintf (num, sizeof num, "%zu", nr_attrs);
      |                                ^
xattr.c:478:32: note: directive argument in the range [0, 2305843009213693950]
/usr/include/bits/stdio2.h:71:10: note: '__builtin___snprintf_chk' output between 2 and 20 bytes into a destination of size 16
   71 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^
2021-09-07 15:55:43 +01:00
Richard W.M. Jones
d00c36410b daemon/luks.c: Ignore bogus GCC -fanalyzer double-free warning
As far as I can tell the analysis is completely bogus.  We don't
double-free the tempfile string in do_luks_add_key.  Therefore add a
GCC suppression around the remove_temp function.

luks.c: In function 'do_luks_add_key':
luks.c:84:3: error: double-'free' of 'tempfile_14' [CWE-415] [-Werror=analyzer-double-free]
   84 |   free (tempfile);
      |   ^~~~~~~~~~~~~~~
  'do_luks_add_key': events 1-2
    |
    |  143 | do_luks_add_key (const char *device, const char *key, const char *newkey,
    |      | ^~~~~~~~~~~~~~~
    |      | |
    |      | (1) entry to 'do_luks_add_key'
    |......
    |  146 |   char *keyfile = write_key_to_temp (key);
    |      |                   ~~~~~~~~~~~~~~~~~~~~~~~
    |      |                   |
    |      |                   (2) calling 'write_key_to_temp' from 'do_luks_add_key'
    |
    +--> 'write_key_to_temp': events 3-12
           |
           |   41 | write_key_to_temp (const char *key)
           |      | ^~~~~~~~~~~~~~~~~
           |      | |
           |      | (3) entry to 'write_key_to_temp'
           |......
           |   47 |   tempfile = strdup ("/tmp/luksXXXXXX");
           |      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~
           |      |              |
           |      |              (4) allocated here
           |   48 |   if (!tempfile) {
           |      |      ~
           |      |      |
           |      |      (5) assuming 'tempfile_14' is non-NULL
           |      |      (6) following 'false' branch (when 'tempfile_14' is non-NULL)...
           |......
           |   53 |   fd = mkstemp (tempfile);
           |      |   ~~
           |      |   |
           |      |   (7) ...to here
           |   54 |   if (fd == -1) {
           |      |      ~
           |      |      |
           |      |      (8) following 'false' branch...
           |......
           |   59 |   len = strlen (key);
           |      |   ~~~
           |      |   |
           |      |   (9) ...to here
           |   60 |   if (xwrite (fd, key, len) == -1) {
           |      |      ~
           |      |      |
           |      |      (10) following 'false' branch...
           |......
           |   66 |   if (close (fd) == -1) {
           |      |   ~~ ~
           |      |   |  |
           |      |   |  (12) following 'false' branch...
           |      |   (11) ...to here
           |
         'write_key_to_temp': event 13
           |
           |cc1:
           | (13): ...to here
           |
    <------+
    |
  'do_luks_add_key': events 14-17
    |
    |  146 |   char *keyfile = write_key_to_temp (key);
    |      |                   ^~~~~~~~~~~~~~~~~~~~~~~
    |      |                   |
    |      |                   (14) returning to 'do_luks_add_key' from 'write_key_to_temp'
    |  147 |   if (!keyfile)
    |      |      ~
    |      |      |
    |      |      (15) following 'false' branch...
    |......
    |  150 |   char *newkeyfile = write_key_to_temp (newkey);
    |      |   ~~~~               ~~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |   |                  |
    |      |   |                  (17) calling 'write_key_to_temp' from 'do_luks_add_key'
    |      |   (16) ...to here
    |
    +--> 'write_key_to_temp': events 18-26
           |
           |   41 | write_key_to_temp (const char *key)
           |      | ^~~~~~~~~~~~~~~~~
           |      | |
           |      | (18) entry to 'write_key_to_temp'
           |......
           |   47 |   tempfile = strdup ("/tmp/luksXXXXXX");
           |      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~
           |      |              |
           |      |              (19) allocated here
           |   48 |   if (!tempfile) {
           |      |      ~
           |      |      |
           |      |      (20) following 'false' branch (when 'tempfile_14' is non-NULL)...
           |......
           |   53 |   fd = mkstemp (tempfile);
           |      |   ~~
           |      |   |
           |      |   (21) ...to here
           |   54 |   if (fd == -1) {
           |      |      ~
           |      |      |
           |      |      (22) following 'false' branch...
           |......
           |   59 |   len = strlen (key);
           |      |   ~~~
           |      |   |
           |      |   (23) ...to here
           |   60 |   if (xwrite (fd, key, len) == -1) {
           |      |      ~
           |      |      |
           |      |      (24) following 'false' branch...
           |......
           |   66 |   if (close (fd) == -1) {
           |      |   ~~ ~
           |      |   |  |
           |      |   |  (26) following 'false' branch...
           |      |   (25) ...to here
           |
         'write_key_to_temp': event 27
           |
           |cc1:
           | (27): ...to here
           |
    <------+
    |
  'do_luks_add_key': events 28-32
    |
    |   84 |   free (tempfile);
    |      |   ~~~~~~~~~~~~~~~
    |      |   |
    |      |   (31) first 'free' here
    |      |   (32) second 'free' here; first 'free' was at (31)
    |......
    |  150 |   char *newkeyfile = write_key_to_temp (newkey);
    |      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |                      |
    |      |                      (28) returning to 'do_luks_add_key' from 'write_key_to_temp'
    |  151 |   if (!newkeyfile) {
    |      |      ~
    |      |      |
    |      |      (29) following 'false' branch...
    |......
    |  156 |   const char *argv[MAX_ARGS];
    |      |   ~~~~~
    |      |   |
    |      |   (30) ...to here
    |
cc1: all warnings being treated as errors
2021-09-07 14:53:06 +01:00
Richard W.M. Jones
8dd09a16f5 daemon/inotify.c: Clean up error handling
In particular avoid calling fclose on a popen'd handle.

Error identified by GCC -fanalyzer.
2021-09-07 14:48:03 +01:00
Laszlo Ersek
81ad309d47 Update common submodule to commit 19302b64c5f1
Short log:

Laszlo Ersek (2):
      Makefile.am: supply missing $(LIBGUESTFS_CFLAGS)
      Makefile.am: use $(LIBGUESTFS_LIBS) for linking OCaml test programs

Richard W.M. Jones (4):
      tools: Refactor create_standard_options
      tools: Add optional --program-name flag.
      mltools/test-getopt.sh: Allow test to work for tools version 2
      mltools: Add JSON_parser.object_get_bool

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2021-09-06 18:16:11 +02:00
Richard W.M. Jones
4e02c13941 m4/guestfs-appliance.m4: Add support for Alma and Cloud Linux
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2001636
Thanks: sasha121196@mail.ru
2021-09-06 17:02:19 +01:00
Richard W.M. Jones
ae7187af94 appliance: Add mount package for Debian
https://listman.redhat.com/archives/libguestfs/2021-September/msg00013.html

Reported-by: Joerg Schiermeier
2021-09-06 15:23:03 +01:00
Laszlo Ersek
0a2f7621a0 tests/mount-local: fix relative pathname of FUSE client executable
In commit 6d32773e81 ("tests: Run the tests in parallel.", 2021-03-18),
the working directory relative to which "test-parallel-mount-local" would
be launched (by the test machinery) changed from "tests/mount-local" to
just "tests".

While the relative pathname of the "guestunmount" executable was updated
inside "test-parallel-mount-local" accordingly, the relative pathname of
the FUSE client ("test-parallel-mount-local" itself, just invoked with
"--test") was not. This issue guarantees that the exec call fails in the
child, and so the test case always hangs.

Because we had removed "mount-local" from the end of the working
directory, prepend it now to the relative pathname of the FUSE client
executable.

Fixes: 6d32773e81
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20210902135124.15191-3-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2021-09-03 12:06:54 +02:00
Laszlo Ersek
79d7fc8674 tests/mount-local: exit child immediately when exec fails
Each worker thread of "test-parallel-mount-local" performs the following
steps (among others):

(1) it starts an appliance dedicated to that thread, using a private
    scratch disk image,

(2) exports a dedicated FUSE mount point on the host, exposing the file
    system on the appliance's disk,

(3) launches a child process for manipulating the particular FUSE mount
    point on the host,

(4) enters a FUSE request processing loop, translating requests between
    the host kernel (coming in via the FUSE mount point) and the
    appliance.

Items to note:

- The child process from step (3) consists of a single thread of execution
  (see fork() in POSIX): a duplicate of the parent process's respective
  worker thread.

- The child process from step (3) blocks on any FUSE mount point access on
  the host until the worker thread in the parent process starts processing
  FUSE requests, in step (4).

- The FUSE request processing in step (4), in the worker thread living in
  the parent process, terminates if and only if the child process unmounts
  the FUSE mount point originating from (2).

Should the exec call in step (3) fail for any reason, the child currently
jumps to the "error" label. This is wrong: under the error label, we call
guestfs_close() on the appliance -- but the appliance is owned by the
parent process's worker thread, not the child. What happens is that the
child kills off the appliance while the parent's worker thread is in the
FUSE request processing loop (4).

The "error" label was never meant to be reached by the child process -- if
exec fails for any reason, exit the child immediately. The parent will
remain in the FUSE request processing loop (4) forever, but no state will
be corrupted. For example, using another (interactive) session on the
host, the FUSE mount points can be interacted with, and if all of them are
manually unmounted, the FUSE request processing (4) completes in every
worker thread.

This patch does not fix the primary issue with
"test-parallel-mount-local", but removes "chaos" from the symptoms. The
next patch will fix the actual regression in this test case.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20210902135124.15191-2-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2021-09-03 12:06:45 +02:00
Richard W.M. Jones
13a1ae6da6 Version 1.45.7. 2021-08-31 16:32:02 +01:00
Hilko Bengen
39f514b28d appliance: Fix searching for shared libraries on usr-merged Debian systems
If /lib is a symlink to usr/lib, paths to shared libraries as
determined by ld.so may differ from dpkg's file lists.

We turn the filename search pattern into a glob expression by
prefixing it with a '*', so the required packages are found again:

$ dpkg -S /lib/x86_64-linux-gnu/libpcre2-8.so.0
dpkg-query: no path found matching pattern /lib/x86_64-linux-gnu/libpcre2-8.so.0
$ dpkg -S */lib/x86_64-linux-gnu/libpcre2-8.so.0
libpcre2-8-0:amd64: /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0
2021-08-31 15:49:55 +01:00
Richard W.M. Jones
45de287447 lib: Autodetect backing format for qemu-img create -b
qemu 6.1 has decided to change qemu-img create so that a backing
format (-F) is required if a backing file (-b) is specified.  Since we
don't want to change the libguestfs API to force callers to specify
this because that would be an API break, autodetect it.

This is similar to commit c8c181e8d9 ("launch: libvirt: Autodetect
backing format for readonly drive overlays").

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1998820
2021-08-31 08:35:52 +01:00
Alexandre Iooss
210959cc34 build: Define HAVE_RPM, HAVE_DPKG and HAVE_PACMAN
When using option `--with-distro`, `HAVE_RPM`, `HAVE_DPKG` and
`HAVE_PACMAN` are not defined and make the configure phase fail.
This makes sure that these conditionals are always defined.
2021-08-27 20:25:14 +01:00
Richard W.M. Jones
73cd0a0c8d lib: Add osinfo information for Windows Server 2022 Datacenter
Windows Server 2022 preview is identified as <osinfo>win2k16</osinfo>.
Although current osinfo-db does not have an entry "win2k22", return
this instead.

osinfo-db issue to add win2k22:
https://gitlab.com/libosinfo/osinfo-db/-/issues/82

Inspection information for the guest:

    type: windows
    distro: windows
    product_name: Windows Server 2022 Datacenter
    product_variant: Server
    version: 10.0
    arch: x86_64

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1997446
Reported-by: Yongkui Guo
2021-08-25 11:09:37 +01:00
Heinrich Schuchardt
efb3d01992 launch: board model for RISC-V
On RISC-V there is no default machine type. Invoking QEMU requires to
specify a board model with the -M option. So let's define MACHINE_TYPE
as virt.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2021-08-20 08:13:10 +01:00
Richard W.M. Jones
90a076fe19 appliance: Add IBM850 iconv converter for syslinux
$ guestfish -N fs:vfat:2G syslinux /dev/sda1
libguestfs: error: syslinux: Error converting to codepage 850 Invalid argument
...

This happens because of the default codepage requested by syslinux
(code page 850) combined with the appliance missing the iconv
converter for this codepage.

Reported-by: Yongkui Guo
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1990720
2021-08-06 08:26:51 +01:00
Richard W.M. Jones
e84c63a2ca python: Don't leak fields when creating Python structs
When creating and returning a Python struct we were adding fields from
the C struct, but did not reduce the ref count on the temporary value
after it had been moved to the struct, resulting in a memory leak.

Reported-by: 朱丹 <zhudan24@huawei.com>
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1985912
2021-07-27 08:58:28 +01:00
Martin Kletzander
e68a844eb4 build: Don't use non-POSIX tests
The `test` builtin/binary usually accepts `==` for string comparison, it is
mostly accepted for typos and people being used to double equals, but is not
documented and not always accepted either.  Since autoconf uses the default
shell, it might just fail in some cases with:

    ./configure: 29986: test: xrustc: unexpected operator
    ./configure: 29990: test: xcargo: unexpected operator

Just change it to single equals as it is done everywhere else.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2021-06-01 10:34:58 +01:00
Richard W.M. Jones
6410c99844 Version 1.45.6. 2021-05-27 17:32:10 +01:00
Richard W.M. Jones
0b223a2877 test-data: Replace deprecated luks_open with cryptsetup_open.
The two calls are identical, so this simply avoids a deprecation
warning.
2021-05-27 17:21:16 +01:00
Daniel P. Berrangé
5e98999b1f point users to Libera Chat rather than FreeNode
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-05-27 13:00:36 +01:00
Richard W.M. Jones
047cf7dcd2 daemon/link.c: Fix out of memory error when reading symlinks
Commit 0f54df53d2 ("build: Remove gnulib") introduced a bug when I
rewrote existing code that used gnulib areadlink().

A missing "continue" statement on the path where fstatat(2) failed
caused fall-through to the case where it tries to use malloc(3) on the
value from the uninitialized stat buf.  This caused a huge amount of
memory to be allocated, invoking the oom-killer inside the appliance.

Reported-by: Yongkui Guo
Fixes: commit 0f54df53d2
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1960217
2021-05-13 12:04:41 +01:00
Richard W.M. Jones
51d21f7684 daemon: Fix isoinfo on files
Commit 2f587bbaec ("daemon: Read ISO9660 Primary Volume Descriptor
directly.") changed daemon/isoinfo.ml to read the PVD directly.  This
was fine for guestfs_isoinfo_device which opens a device name, but did
not work for ISOs embedded within filesystems opened using
guestfs_isoinfo because we did not chroot into the filesystem first.

Example reproducer (run from the libguestfs source directory):

$ guestfish -N fs -m /dev/sda1 upload ./test-data/test.iso /test.iso
$ guestfish --ro -a test1.img -m /dev/sda1 isoinfo /test.iso
libguestfs: error: isoinfo: open: /test.iso: No such file or directory

After this fix:

$ guestfish --ro -a test1.img -m /dev/sda1 isoinfo /test.iso
iso_system_id:
iso_volume_id: ISOIMAGE
iso_volume_space_size: 2490
[etc.]

Reported-by: Yongkui Guo
Fixes: commit 2f587bbaec
Fixes: https://bugzilla.redhat.com/show_bug.cgi
2021-05-13 09:19:31 +01:00
Richard W.M. Jones
d01ce08218 rust: Fix deprecated use of panic!(format!(...))
warning: panic message is not a string literal
 --> src/bin/event_leak.rs:9:30
  |
9 |             Err(e) => panic!(format!(" could not create handle {:?}", e)),
  |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(non_fmt_panic)]` on by default
  = note: this is no longer accepted in Rust 2021
  = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
2021-05-05 12:57:51 +01:00
Richard W.M. Jones
d3bbc02190 lib: qemu: Don't use -enable-fips option.
QEMU has deprecated this option:

    commit 166310299a1e7824bbff17e1f016659d18b4a559
    Author: Daniel P. Berrangé
    Date:   Tue Oct 20 17:08:27 2020 +0100

    os: deprecate the -enable-fips option and QEMU's FIPS enforcement

    The -enable-fips option was added a long time ago to prevent the use of
    single DES when VNC when FIPS mode is enabled. It should never have been
    added, because apps are supposed to unconditionally honour FIPS mode
    based on the '/proc/sys/crypto/fips_enabled' file contents.

    In addition there is more to achieving FIPS compliance than merely
    blocking use of certain algorithms. Those algorithms which are used
    need to perform self-tests at runtime.

    QEMU's built-in cryptography provider has no support for self-tests,
    and neither does the nettle library.

    If QEMU is required to be used in a FIPS enabled host, then it must be
    built with the libgcrypt library enabled, which will unconditionally
    enforce FIPS compliance in any algorithm usage.

    Thus there is no need to keep either the -enable-fips option in QEMU, or
    QEMU's internal FIPS checking methods.
2021-05-05 12:50:17 +01:00
Richard W.M. Jones
2883fc2acc python: Relicense setup.py to LGPLv2+ (originally GPLv2+)
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1951560#c3
2021-04-23 10:49:55 +01:00
Richard W.M. Jones
e94d2345bc daemon/isoinfo.ml: Fix offset of Abstract File Identifier
https://listman.redhat.com/archives/libguestfs/2021-April/msg00058.html

Thanks: Thomas Schmitt
2021-04-17 19:00:26 +01:00
Richard W.M. Jones
26427b9ecc inspection: More reliable detection of Linux split /usr configurations
In RHEL 8+, /usr/etc no longer exists.  Since we were looking for this
directory in order to detect a separate /usr partition, those were no
longer detected, so the merging of /usr data into the root was not
being done.  The result was incomplete inspection data and failure of
virt-v2v.

All Linux systems since forever have had /usr/src but not /src, so
detect this instead.

Furthermore the merging code didn't work, because we expected that the
root filesystem had a distro assigned, but in this configuration we
may need to look for that information in /usr/lib/os-release (not on
the root filesystem).  This change makes the merging work even if we
have incomplete information about the root filesystem, so long as we
have an /etc/fstab entry pointing to the /usr mountpoint.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1949683
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1930133
Fixes: commit 394d11be49
2021-04-15 09:41:35 +01:00
Richard W.M. Jones
7ed0da779f Ignore return value from strerror_r.
It seems like newer glibc added warn_unused_result to this function.
Try harder to ignore the result.
2021-04-13 15:40:48 +01:00
Richard W.M. Jones
2ebacabd68 golang: Fix quoting in Makefile.
Fixes: commit c8cab6219f
Fixes: commit 95de3f6c50
2021-04-09 14:27:11 +01:00
Richard W.M. Jones
afe7e16c0f golang: Fix build when libguestfs is not already installed.
See similar fix in libnbd:
031aaefaa8

Fixes: commit 95de3f6c50
2021-04-09 14:27:01 +01:00
Richard W.M. Jones
536b5ed993 Version 1.45.5. 2021-04-09 11:39:10 +01:00
Richard W.M. Jones
4c6de453f1 golang: Add go.mod to EXTRA_DIST.
Fixes: commit 95de3f6c50
2021-04-09 11:38:37 +01:00
Richard W.M. Jones
026b52c848 build: Remove m4/.gitignore from EXTRA_DIST.
This file was removed when we got rid of gnulib, but left in
EXTRA_DIST by mistake.

Fixes: commit 0f54df53d2
2021-04-09 11:37:49 +01:00
Richard W.M. Jones
c8cab6219f golang: Try to deal with srcdir != builddir builds.
Updates: commit 95de3f6c50
Thanks: Gianfranco Costamagna
2021-04-09 11:05:17 +01:00
Richard W.M. Jones
93c2d09136 golang: Partially fix the tests.
./guestfs.go:4945:16: conversion from _Ctype_char (int8) to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
./guestfs.go:7320:16: conversion from _Ctype_char (int8) to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
./guestfs.go:7335:16: conversion from _Ctype_char (int8) to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
2021-04-08 12:59:17 +01:00
Richard W.M. Jones
95de3f6c50 golang: Fix bindings for golang 1.16.
See https://blog.golang.org/go116-module-changes
2021-04-08 12:55:19 +01:00
Richard W.M. Jones
0f54df53d2 build: Remove gnulib.
As part of our efforts to clean up and simplify libguestfs, removing
gnulib deletes a large dependency that we mostly no longer use and
causes problems for new users trying to build the library from source.

A few modules from gnulib are still used (under a compatible license)
and these are copied into gnulib/lib/
2021-04-08 11:36:40 +01:00
Richard W.M. Jones
48e7520ec5 lib/guestfs-internal.h: Remove need to include gnulib "hash.h" here.
Centrally including "hash.h" means everything that needs this header
file (everything in lib/) has to depend on gnulib.
2021-04-08 11:12:17 +01:00
Richard W.M. Jones
9cfa1c410f Remove use of gnulib glthread.
This gnulib feature abstracts away threads, locks and TLS, and also
allowed libguestfs to be linked with or without pthread.  However
since pthread these days is part of glibc and so every program is
using pthread, and we want to get rid of gnulib as a dependency, just
use pthread directly.
2021-04-08 11:12:17 +01:00
Richard W.M. Jones
5244d11bd7 generator/bindtests.ml: Remove use of gnulib intprops.h 2021-04-06 13:27:02 +01:00
Richard W.M. Jones
b18ac489db Version 1.45.4. 2021-04-03 12:10:13 +01:00
Richard W.M. Jones
bf28bc01db tests: Fix isoinfo test.
Also remove GUESTFS_ISO_SYSTEM_ID.

Fixes: commit 2f587bbaec
2021-04-03 12:02:35 +01:00
Richard W.M. Jones
278d0d3226 lib/appliance-kcmdline.c: Read UUID directly from appliance.
Instead of using the external file utility, read the UUID directly
from the extfs filesystem.  file 5.40 broke parsing of UUIDs
(https://bugs.astron.com/view.php?id=253).

Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1945122
2021-03-31 13:45:17 +01:00
Richard W.M. Jones
2f587bbaec daemon: Read ISO9660 Primary Volume Descriptor directly.
It turns out we can read the information we need for the isoinfo API
directly from the ISO9660 PVD.  We don't need to use either isoinfo or
xorriso.  This also has the advantages of reducing by 1 the number of
dependencies in the appliance, and reducing potential vulnerability to
a crafted ISO file.

This also fixes timezone calculation for the datetime fields.

Thanks: Thomas Schmitt
Updates: commit efb8a766ca
2021-03-31 11:35:32 +01:00
Richard W.M. Jones
efb8a766ca daemon: Allow xorriso as an alternative to isoinfo.
Currently the guestfs_isoinfo and guestfs_isoinfo_device APIs run
isoinfo inside the appliance to extract the information.

isoinfo is part of genisoimage which is somewhat dead upstream.
xorriso is supposedly the new thing.  (For a summary of the situation
see: https://wiki.debian.org/genisoimage).

This commit rewrites the parsing from C to OCaml to make it easier to
deal with, and allows you to use either isoinfo or xorriso.

Mostly the same fields are available from either tool, but xorriso is
a bit more awkward to parse.
2021-03-30 15:21:54 +01:00
Richard W.M. Jones
2216ab2e32 tests: Prefer xorriso over genisoimage to generate test.iso
This Debian page explains the upstream situation:
https://wiki.debian.org/genisoimage

On Fedora, xorriso provides a compatibility program called "mkisofs".
However this is not present in Debian.  Hence the choice to look for
the program called "xorrisofs".
2021-03-30 13:57:30 +01:00
Richard W.M. Jones
49b8b69cb8 daemon/xfs.c: Fix error message.
Fixes: commit 87206e4e9e
2021-03-30 12:56:58 +01:00
Richard W.M. Jones
0b7207b8c3 Version 1.45.3. 2021-03-29 19:42:29 +01:00
Richard W.M. Jones
8317279c35 m4/guestfs-find-db-tool.m4: Remove unused file.
Fixes: commit 42e5e7cfdb
2021-03-29 18:38:39 +01:00
Richard W.M. Jones
cb8c4d90e1 podwrapper: Use the tarball release date to calculate the stable date.
Fixes: commit eb53d74ba2
2021-03-29 18:29:15 +01:00
Richard W.M. Jones
df983200d7 po/POTFILES: Fix list of files for translation.
Fixes: commit c9ee831aff
2021-03-29 18:25:57 +01:00
Richard W.M. Jones
42e5e7cfdb test-data/phony-guests: Fix phony RPM database, fix virt-inspector test.
libguestfs 1.45.3 now reads the RPM database using librpm, which means
our old phony database created by db_dump can no longer work.  Instead
provide a real (but very minimal) sqlite database.

This commit also fixes the virt-inspector test since the RPM database
contents are now different.
2021-03-29 17:26:43 +01:00
Richard W.M. Jones
fef73bce7e inspection: Return RPM epoch.
Fixes: commit c9ee831aff
2021-03-27 09:31:00 +00:00
Richard W.M. Jones
c9ee831aff inspection: Fix inspection of recent RPM guests using non-BDB.
Recent RPM-based guests have switched from using Berkeley DB (BDB) to
sqlite.  In order to inspect these guests (and earlier ones) we need
to stop using the hokey parsing of the BDB and use librpm APIs
instead.

This commit adds a new internal API so we can call librpm from the
daemon, and changes the library part to use the new API for RPM-based
guests.

This change removes the requirement for BDB tools like db_dump.

See also:
http://lists.rpm.org/pipermail/rpm-ecosystem/2021-March/000751.html
http://lists.rpm.org/pipermail/rpm-ecosystem/2021-March/000754.html
https://blog.fpmurphy.com/2011/08/programmatically-retrieve-rpm-package-details.html

This breaks the virt-inspector test (now in the separate guestfs-tools
repository).  However this is not a bug in libguestfs, but a bug in
the phoney Fedora guest that we use for testing - we created a
BDB-style RPM database which was supposed to be just enough to make
the old code work.  The new code using real librpm needs
/usr/lib/rpm/rpmrc (not present in the phoney image) and also cannot
parse the phoney database, so we will need to separately rework that
test.

Thanks: Panu Matilainen
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1766487
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1409024
2021-03-26 16:26:00 +00:00
Richard W.M. Jones
94e64b28be daemon: chroot: Fix long-standing possible deadlock.
The child (chrooted) process wrote its answer on the pipe and then
exited.  Meanwhile the parent waiting for the child to exit before
reading from the pipe.  Thus if the output was larger than a Linux
pipebuffer then the whole thing would deadlock.
2021-03-26 16:06:03 +00:00
Richard W.M. Jones
48a35c117e tests: btrfs: Use a valid sector size in the test.
Latest btrfs seems to reject 512 byte sector size.  It may be because
of the specific hardware that I'm running the test on.  Anyway using a
4K sector size works.

libguestfs: error: mkfs_btrfs: /dev/sda1: ERROR: invalid sectorsize 512, expected range is [4K, 64K]
2021-03-25 11:57:37 +00:00
Richard W.M. Jones
5b01bcda17 tests: Source test-command and test-pwd from the correct directory.
Fixes: commit 6d32773e81
2021-03-25 11:55:10 +00:00
Richard W.M. Jones
3b1ed4c9bc build: Use correct ounit2 OCaml module.
Also update common module to get the same fix.
2021-03-25 08:26:42 +00:00
Richard W.M. Jones
4991fe5259 bash-completion: Remove completion scripts for tools.
These have moved to guestfs-tools.

Fixes: commit 733d2182b6
2021-03-23 11:08:42 +00:00
Richard W.M. Jones
eb53d74ba2 Don't include huge ChangeLog in the tarball.
Adds a few megabytes which people can easily get from the git
repository.
2021-03-23 10:00:12 +00:00
Richard W.M. Jones
09639387aa Version 1.45.2. 2021-03-22 16:41:30 +00:00
Richard W.M. Jones
008cda2bd2 generator: Do not build mlcustomize if directory does not exist.
When shipping the libguestfs tarball we do not necessarily have
common/mlcustomize.  If we run the generator in this situation then
don't try to generate files in the non-existent directory.

See-also: commit 7ced2b9354
2021-03-22 16:37:55 +00:00
Richard W.M. Jones
b0b2979dce tests: Fix EXTRA_DIST.
Fixes: commit 6d32773e81
2021-03-22 16:27:07 +00:00
Richard W.M. Jones
9dddd8ec62 tests/mount-local/test-parallel-mount-local.c: Fix bogus -fanalyzer warning.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99716 for the reduced
test case.
2021-03-22 15:52:22 +00:00
Richard W.M. Jones
e0a1106103 daemon: Don't return bogus failure from readdir.
This was returning "readdir: Invalid argument" which is actually
impossible (readdir(3) cannot fail with EINVAL).  It turns out that
the problem is just errno from some other place leaking out.
2021-03-22 14:56:10 +00:00
Richard W.M. Jones
e282558581 tests/charsets/test-charset-fidelity.c: Print all errors.
Not just the first error.
2021-03-22 14:49:41 +00:00
Richard W.M. Jones
b5b22893a1 tests/charsets/test-charset-fidelity.c: Fix code indentation regression.
A previous commit adding assert statements (to make -fanalyzer happy)
accidentally broke this test.

Fixes: commit 8a4275c568
2021-03-22 14:49:09 +00:00
Richard W.M. Jones
9108ad152d daemon/btrfs.c: Ignore mkfs.btrfs allocstart option.
This was deprecated in btrfs 4.14.1 and recently removed (see
btrfs-progs commit 4bd94dba8a "btrfs-progs: mkfs: remove alloc start
options and docs").  If the option is set simply ignore it.
2021-03-22 14:26:57 +00:00
Richard W.M. Jones
1eb055bd46 tests/nbd/test-nbd.pl: Multiple improvements.
Use qemu-nbd --pid-file option so we don't have to use an arbitrary
sleep.

Enable all parts of the test, since everything should work now with
various upstream bugs having been fixed in the 8 years since the test
was originally written.
2021-03-22 14:12:43 +00:00
Richard W.M. Jones
d4ab4ff683 tests: Fix test for new libcap output.
libcap commit 177cd41803 ("A more compact form for the text
representation of capabilities.") changed the format used by
cap_to_text(3), breaking our test.  Change the test to cope.  This
will break with older libcap now, but there's not a lot we can do
about it.
2021-03-22 13:52:41 +00:00
Richard W.M. Jones
245d1a3d7c python: Ignore code style error E128. 2021-03-22 13:19:19 +00:00
Richard W.M. Jones
6d32773e81 tests: Run the tests in parallel.
Before this change the tests ran in about 12m34 and afterwards in
about 6m20, although the real change is more dramatic if you only run
tests from the tests/ subdirectory (as language tests still run serially).

This breaks valgrinding for now, which I intend to fix properly later.
2021-03-18 16:28:55 +00:00
Richard W.M. Jones
ff3fdb0418 tests/regressions: Remove virt-resize test rhbz1285847.sh
This test was correctly copied into the new guestfs-tools repository
when virt-resize was moved there along with the other tools.  However
it was never removed from libguestfs.  We were effectively running the
test on the installed virt-resize.

Fixes: commit 733d2182b6
2021-03-18 13:55:20 +00:00
Richard W.M. Jones
22e9b682a4 tests: Remove obsolete automake2junit script.
Originally added in commit 38fbda9d37 as
a way to integrate the output from automake into CI systems, but not
actually used.
2021-03-18 13:54:44 +00:00
Richard W.M. Jones
13ceb6a87b appliance: Use <cpu mode="maximum"/> for -cpu max on libvirt.
Note this requires libvirt >= 7.1.0 which was only released in March 2021.

With an older libvirt you will see this error:

  Original error from libvirt: unsupported configuration: Invalid mode attribute 'maximum' [code=67 int1=-1]

In theory we could check if this is supported by looking at the
libvirt capabilities and fall back, but this commit does not do that,
in the expectation that most people will be using the default backend
(direct) and on Fedora/RHEL we will add an explicit minimum version
dependency to the package.

qemu support has been around quite a bit longer (at least since 2017).

Fixes: commit 30f74f38bd
2021-03-18 12:42:35 +00:00
Richard W.M. Jones
24e112c1b7 perl: Remove dependency on Win::Hivex::*
This is used in virt-win-reg, but that tool have moved out to
guestfs-tools so the dependency is no longer needed by libguestfs
itself.

Fixes: commit 733d2182b6
2021-03-18 12:19:55 +00:00
Richard W.M. Jones
061be6bb84 tests: Remove dependency on Sys::Virt.
This was only used for a single rule (check-valgrind-local-guests)
which ran "make check-valgrind" on local guests.  This was never
really used by me and was fairly inadvisable anyway, so we can easily
remove it and thus remove the dependency on perl Sys::Virt.
2021-03-18 12:16:28 +00:00
Sam Eiderman
5d686b92a6 launch: libvirt, direct: Add force_kvm backend setting.
By using:

  export LIBGUESTFS_BACKEND_SETTINGS=force_kvm

you can force the backend to use KVM and never fall back to
TCG (software emulation).
2021-03-16 16:11:23 +00:00
Richard W.M. Jones
f8f424325c Update common to get OCaml PCRE module fix. 2021-03-16 15:13:49 +00:00
Richard W.M. Jones
82493579f3 Port libguestfs to use pcre2 instead of pcre.
https://bugzilla.redhat.com/show_bug.cgi?id=1938982
2021-03-16 11:24:37 +00:00
Richard W.M. Jones
fbf573d2c9 daemon/daemon-c.c: Fix whitespace. 2021-03-16 11:24:37 +00:00
Richard W.M. Jones
733d2182b6 Remove the tools.
These have now moved to a new repository.  Provisionally it is here:

https://github.com/rwmjones/guestfs-tools/

but this is not the final location, as it will eventually be hosted on
gitlab.com.

The tarballs are here:

https://download.libguestfs.org/guestfs-tools/
2021-03-11 13:58:41 +00:00
Remi Collet
ff4080378d php: Fix the build. 2021-03-05 13:22:05 +00:00
Richard W.M. Jones
a009a4cf6f Version 1.45.1. 2021-03-03 12:35:48 +00:00
Richard W.M. Jones
e743fb94d6 Update common. 2021-03-02 10:43:55 +00:00
Richard W.M. Jones
5f499208cf builder: Don't redefine Val_none (OCaml 4.12).
CC       virt_builder-setlocale-c.o
setlocale-c.c:38: error: "Val_none" redefined [-Werror]
   38 | #define Val_none (Val_int (0))
      |
In file included from /usr/lib64/ocaml/caml/alloc.h:24,
                 from setlocale-c.c:23:
/usr/lib64/ocaml/caml/mlvalues.h:395: note: this is the location of the previous definition
  395 | #define Val_none Val_int(0)
      |
2021-03-02 10:42:49 +00:00
Richard W.M. Jones
21cd97732c daemon: lvm: Use lvcreate --yes to avoid interactive prompts.
See https://bugzilla.redhat.com/show_bug.cgi?id=1930996#c1

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1930996
2021-02-22 11:04:15 +00:00
Richard W.M. Jones
064c3b6a94 Update common submodule. 2021-02-22 10:38:19 +00:00
Richard W.M. Jones
20dbc24d68 lib/fuse.c: Use safe_malloc instead of malloc.
Avoids having to check the return value, and in this case avoids a GCC
analyzer error.
2021-02-22 10:38:19 +00:00
Richard W.M. Jones
c253398247 fuse/guestmount.c: Avoid leaking fp on error path.
Bug found by GCC analyzer.
2021-02-22 10:38:19 +00:00
Richard W.M. Jones
acefa23758 diff: Don't try to call unlink(NULL) on certain error paths.
Actual bug found by GCC analyzer.
2021-02-22 10:38:19 +00:00
Richard W.M. Jones
001c1dc09f daemon/tar.c: Avoid bogus GCC analyzer warning.
See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99196
2021-02-22 10:38:19 +00:00
Richard W.M. Jones
4af1c631a2 daemon/command.c daemon/debug.c df/main.c: Ignore bogus GCC analyzer warnings
See upstream bug report:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99193
2021-02-22 10:37:49 +00:00
Richard W.M. Jones
f19fd566f6 appliance: Add dhclient for Arch-like Manjaro distro.
Thanks: hatifnatt on IRC
2021-02-17 09:44:19 +00:00
Richard W.M. Jones
30f74f38bd appliance: Use -cpu max.
QEMU has a newish feature (from about 2017 / qemu 2.9) called -cpu max
which is supposed to select the best CPU, ideal for libguestfs.

After this change, on x86-64:

               KVM                          TCG

Direct         -cpu max                     -cpu max
(non-libvirt)

Libvirt   <cpu mode="host-passthrough">     <cpu mode="host-model">
            <model fallback="allow"/>         <model fallback="allow"/>
          </cpu>                            </cpu>

Thanks: Daniel Berrangé
2021-01-28 14:04:29 +00:00
Richard W.M. Jones
7ac82beb89 fish/tilde.c: Suppress more bogus -fanalyser warnings. 2021-01-28 12:27:41 +00:00
Richard W.M. Jones
fdda111e0e lib/qemu.c: Suppress another bogus -fanalyser warning. 2021-01-28 12:27:41 +00:00
Richard W.M. Jones
4e66dd5736 website/download/builder/index: Automatic update.
Updates: commit 97902a9cf6
2021-01-28 12:27:41 +00:00
Richard W.M. Jones
97902a9cf6 builder: templates: Add ubuntu-20.04.
The reason is wasn't working before is that virt-manager was missing
this fix:

b55b7e9462/virtinst/install/urldetect.py

Thanks: fepitre on IRC
2021-01-28 11:57:36 +00:00
Richard W.M. Jones
8670e4ee90 builder: templates: Added rhel-7.9. 2021-01-27 11:57:41 +00:00
Richard W.M. Jones
03347d49ee lib: Move CLEANUP_GL_RECURSIVE_LOCK_UNLOCK to libguestfs header.
Previously this was in common/utils.  However it is not used anywhere
else, and guestfs-tools wants to remove gnulib dependencies, so move
this to libguestfs.
2021-01-22 13:39:16 +00:00
Richard W.M. Jones
fb7b683a29 appliance: Avoid having ${exec_prefix} in guestfs appliance path.
Normally packagers should try to use ./configure --with-guestfs-path=...
However if they do not, then a regression in 1.44 caused the path to
constain the literal string "${exec_prefix}".  This was because of
autoconf stupidity.

Try to resolve this by expanding ${exec_prefix} to something sensible.

The expansion will often be wrong (but at least it will now be a valid
path), hence the recommendation to always set --libdir and/or
--with-guestfs-path when configuring.

Fixes: commit 94ff24b880
Fixes: https://bugzilla.redhat.com/1915646
2021-01-15 14:20:00 +00:00
Richard W.M. Jones
0c82987531 builder: Fix Fedora 33 boot problem.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1911177
Thanks: Daniel P. Berrangé
2021-01-13 12:35:47 +00:00
Richard W.M. Jones
812f837c97 build: Avoid warnings about unknown pragmas.
In commit 4bbbf03b8b we started to
ignore bogus GCC 11 warnings.  Unfortunately earlier versions of GCC
don't know about those pragmas so give warnings [hence errors in
developer builds] like:

tsk.c:75:32: error: unknown option after '#pragma GCC diagnostic' kind [-Werror=pragmas]

Turn off these warnings.

Updates: commit 4bbbf03b8b
2021-01-12 10:27:35 +00:00
Richard W.M. Jones
de9a5e59f1 Version 1.44.0. 2021-01-06 10:18:34 +00:00
Richard W.M. Jones
8cf46e4886 docs: Add release notes for libguestfs 1.44.
This is quite a small release.
2021-01-05 19:41:31 +00:00
Richard W.M. Jones
675b336f63 gnulib: Update to latest. 2021-01-05 15:53:51 +00:00
Richard W.M. Jones
8ec4f256f2 Version 1.43.4. 2021-01-05 14:25:01 +00:00
Richard W.M. Jones
a9975a5a9b common: Update to latest. 2021-01-05 10:32:20 +00:00
Richard W.M. Jones
26f5cdaab3 rescue: Don't call exit(3) from a signal handler.
Found by GCC 11 analyzer.
2021-01-05 10:31:08 +00:00
Richard W.M. Jones
4bbbf03b8b Ignore completely bogus GCC 11 warnings.
Various varieties of this:

           |   45 |   tempfile = strdup ("/tmp/luksXXXXXX");
           |      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~
           |      |              |
           |      |              (19) this call could return NULL
           |   46 |   if (!tempfile) {
           |      |      ~
           |      |      |
           |      |      (20) following 'false' branch (when 'tempfile' is non-NULL)...
           |......
           |   51 |   fd = mkstemp (tempfile);
           |      |   ~~   ~~~~~~~~~~~~~~~~~~
           |      |   |    |
           |      |   |    (22) argument 1 ('tempfile') from (19) could be NULL where non-null expected
           |      |   (21) ...to here
2021-01-05 10:31:00 +00:00
Richard W.M. Jones
07585189cf lib: Ignore a bunch of bogus GCC 11 warnings.
-Werror=analyzer-file-leak doesn't follow CLEANUP_FCLOSE properly.

yara.c:64:24: error: leak of FILE '<unknown>' [CWE-775] [-Werror=analyzer-file-leak]
   64 |   CLEANUP_FCLOSE FILE *fp = NULL;
      |                        ^~
2021-01-05 10:09:21 +00:00
Richard W.M. Jones
6d0ab14b56 tar-in: Add workaround because tar doesn't restore capabilities (RHBZ#1384241).
Current GNU tar does not restore all extended attributes.  In
particular only user.* capabilities are restored (although all
are saved in the tarball).

To restore capabilities, SELinux security attributes, and other things
we need to use --xattrs-include=*

For further information on the tar bug, see:
https://bugzilla.redhat.com/show_bug.cgi?id=771927
2020-12-11 10:23:21 +00:00
Richard W.M. Jones
b2e457767d Version 1.43.3. 2020-12-01 16:47:32 +00:00
Richard W.M. Jones
8a4275c568 tests/charsets/test-charset-fidelity.c: Asserts to avoid bogus CWE-690.
The new GCC static analyzer has trouble understanding when some
strings are non-NULL.  Adding asserts helps avoid warnings.
2020-12-01 15:39:53 +00:00
Richard W.M. Jones
6573ae6ee4 Update gnulib to latest. 2020-12-01 15:35:45 +00:00
Richard W.M. Jones
3d2c38d5ab m4: Define INCLUDE_DIRECTORY for libguestfs only. 2020-12-01 14:31:12 +00:00
Richard W.M. Jones
a624016baa common: Update to latest submodule. 2020-12-01 12:39:47 +00:00
Thierry Vignaud
d2611b62e9 include rpm for Mageia
This fixes:
"-supermin: ext2fs_namei: parent directory not found:
/var/lib/rpm: File not found by ext2_lookup"

This because chkconfig contains /var/lib/rpm/alternatives on Mageia
2020-11-24 09:30:06 +00:00
Thierry Vignaud
32021c72fe Include exfatprogs
It's the new upstream name of exfat-utils.
As eg found on Mageia.
2020-11-24 09:28:05 +00:00
Thierry Vignaud
d63c8041d5 fix detecing db_* tool on Mageia 2020-11-24 09:28:05 +00:00
Thierry Vignaud
e62ccfca4a explain how to install on Mageia 2020-11-24 09:28:05 +00:00
Thierry Vignaud
999fca8731 appliance: Add ntfs-3g-system-compression for Mageia
This package in Mageia enables optional support for Windows 10
"CompactOS" (file-level compression), read-only, which is sufficient
for inspecting Windows guests and doing certain types of modifications
to them.  Virt-v2v appears to work, but it may be that anything that
involves modifying a compressed file might not work.

See commit e6764a5415
2020-11-12 10:36:03 +00:00
Richard W.M. Jones
3f5d080d02 builder: templates: Add Fedora 33 2020-11-02 10:13:22 +00:00
Dmitry Tantsur
fe52d9fd0c rust: fix a typo in the crates.io link 2020-10-28 10:34:04 +00:00
Richard W.M. Jones
0896dea338 gnulib: Replace hash_delete with hash_remove.
Renamed in gnulib with the old function deprecated.
2020-10-22 14:50:58 +01:00
Richard W.M. Jones
e49be55630 m4/.gitignore: Update.
Fixes: commit cfcd3385cc
2020-10-22 14:50:33 +01:00
Richard W.M. Jones
cfcd3385cc Update gnulib to master. 2020-10-22 14:05:35 +01:00
Hilko Bengen
133a491677 Use guestfsd binary to auto-generate library dependencies for appliance
The ELF NEEDED are used to determine guestfsd's library dependencies
with help from the dynamic linker and the package manager.

This was prompted by Debian bug #972241 which was caused by a
libtirpc package renaming in Debian/unstable because the SONAME had
been changed.
2020-10-19 12:14:34 +01:00
Richard W.M. Jones
3f4a529ab7 fuse: Don't override access(X_OK) if user is root.
Bug originally reported here by trysis:
https://stackoverflow.com/questions/64273334/test-x-in-mounted-filesystem

If the user is root then we override normally access controls in FUSE,
see https://bugzilla.redhat.com/show_bug.cgi?id=1106548.

However this causes test -x to mark all files as executable.  We
shouldn't let root execute any file, only ones which have the 'x' bit
set.  Therefore this narrows the fix in bug 1106548 so it only applies
to read and write bits.

To test this I created a disk with guestfish which had an executable
and a non-executable file:

  $ guestfish -N fs -m /dev/sda1
  ><fs> touch /file1
  ><fs> touch /file2
  ><fs> chmod 0755 /file1
  ><fs> ll /
  total 24
  drwxr-xr-x  3 root root  4096 Oct 12 14:04 .
  drwxr-xr-x 19 root root  4096 Oct 12 14:04 ..
  -rwxr-xr-x  1 root root     0 Oct 12 14:04 file1
  -rw-r--r--  1 root root     0 Oct 12 14:04 file2
  drwx------  2 root root 16384 Oct 12 14:04 lost+found

I then mounted and tested it as non-root:

  $ guestmount -a test1.img -m /dev/sda1 /tmp/mnt -v -x
  $ ls -l /tmp/mnt
  total 16
  -rwxr-xr-x. 1 root root     0 Oct 12 15:04 file1
  -rw-r--r--. 1 root root     0 Oct 12 15:04 file2
  drwx------. 2 root root 16384 Oct 12 15:04 lost+found
  $ test -x /tmp/mnt/file1; echo $?
  0
  $ test -x /tmp/mnt/file2; echo $?
  1

and as root:

  $ sudo guestmount -a test1.img -m /dev/sda1 /tmp/mnt -v -x
  $ test -x /tmp/mnt/file1; echo $?
  0
  $ test -x /tmp/mnt/file2; echo $?
  0

In the debug output for non-root we can see the difference:

  libguestfs: /file1: testing access mask X_OK: caller UID:GID = 1000:1000, file UID:GID = 0:0, file mode = 100755, result = OK
  libguestfs: /file2: testing access mask X_OK: caller UID:GID = 1000:1000, file UID:GID = 0:0, file mode = 100644, result = EACCESS

and for root:

  libguestfs: /file1: testing access mask X_OK: caller UID:GID = 0:0, file UID:GID = 0:0, file mode = 100755, result = OK
  libguestfs: /file2: testing access mask X_OK: caller UID:GID = 0:0, file UID:GID = 0:0, file mode = 100644, result = OK

After this commit the root output changes to this (ie. same decision
as non-root):

  libguestfs: /file1: testing access mask X_OK: caller UID:GID = 0:0, file UID:GID = 0:0, file mode = 100755, result = OK
  libguestfs: /file2: testing access mask X_OK: caller UID:GID = 0:0, file UID:GID = 0:0, file mode = 100644, result = EACCESS
2020-10-12 15:17:41 +01:00
Richard W.M. Jones
4663112d89 lib/canonical-name.c: Hide errors from underlying API call.
When guestfs_lvm_canonical_lv_name was called with a /dev/dm* or
/dev/mapper* name which was not an LV then a noisy error would be
printed.  This would typically have happened with encrypted disks, and
now happens very noticably when inspecting Windows BitLocker-
encrypted guests.

This commit hides this error in all cases, although it is still logged
to debug.  See comment and the thread below for detailed rationale.

https://www.redhat.com/archives/libguestfs/2020-October/thread.html#00055
2020-10-12 10:46:10 +01:00
Richard W.M. Jones
5631106a73 daemon: lvm_canonical_lv_name: Return EINVAL if called with non-LV.
Previously callers were unable to distinguish a regular error (like an
I/O error) from the case where you call this API on something which is
valid but not a logical volume.  Set errno to a known value in this
case.
2020-10-12 10:44:29 +01:00
Richard W.M. Jones
86577ee388 daemon: Search device-mapper devices for list-filesystems API.
In case any bare filesystems were decrypted using cryptsetup-open,
they would appear as /dev/mapper/name devices.  Since list-filesystems
did not consider those when searching for filesystems, the unencrypted
filesystems would not be returned.

Note that previously this worked for LUKS because the common case
(eg. for Fedora) was that whole devices were encrypted and thoes
devices contained LVs, so luks-open + vgactivate would activate the
LVs which would then be found by list-filesystems.  For Windows
BitLocker, the common case seems to be that each separate NTFS
filesystem is contained in a separate BitLocker wrapper.
2020-10-12 10:44:29 +01:00
Richard W.M. Jones
79f3d451a8 daemon: Reimplement list_dm_devices API in OCaml.
Simple refactoring.  The only annoying point is requiring an extra
module because of OCaml module dependency restrictions.
2020-10-12 10:44:29 +01:00
Richard W.M. Jones
41cbc89330 daemon: Ignore BitLocker disks in list-filesystems API. 2020-10-12 10:44:29 +01:00
Richard W.M. Jones
6e870a8e43 daemon: Rewrite list-filesystems implementation imperatively.
Simple refactoring to make the code clearer, should have no other
effect.
2020-10-12 10:44:29 +01:00
Richard W.M. Jones
c8e0b45389 fish: Update documentation to refer to cryptsetup-open/close and BitLocker. 2020-10-12 10:44:29 +01:00
Richard W.M. Jones
c456ea0332 New APIs: cryptsetup-open and cryptsetup-close.
This commit deprecates luks-open/luks-open-ro/luks-close for the more
generic sounding names cryptsetup-open/cryptsetup-close, which also
correspond directly to the cryptsetup commands.

The optional cryptsetup-open readonly flag is used to replace the
functionality of luks-open-ro.

The optional cryptsetup-open crypttype parameter can be used to select
the type (corresponding to cryptsetup open --type), which allows us to
open BitLocker-encrypted disks with no extra effort.  As a convenience
the crypttype parameter may be omitted, and libguestfs will use a
heuristic (based on vfs-type output) to try to determine the correct
type to use.

The deprecated functions and the new functions are all (re-)written in
OCaml.

There is no new test here, unfortunately.  It would be nice to test
Windows BitLocker support in this new API, however the Linux tools do
not support creating BitLocker disks, and while it is possible to
create one under Windows, the smallest compressed disk I could create
is 37M because of a mixture of the minimum support size for BitLocker
disks and the fact that encrypted parts of NTFS cannot be compressed.

Also synchronise with common module.
2020-10-12 10:44:08 +01:00
Richard W.M. Jones
bfd0886765 golang: Fix path to include/guestfs.h.
Thanks: Martin Kletzander
Fixes: commit 75abec1f70
2020-10-06 15:26:14 +01:00
Pino Toscano
dbfab7d3b2 build: fix includedir in uninstalled libguestfs.pc
Update includedir with the new directory that contains guestfs.h.

Updates commit 75abec1f70.
2020-09-22 18:12:05 +02:00
Richard W.M. Jones
b89f377540 Version 1.43.2. 2020-09-21 18:56:18 +01:00
Richard W.M. Jones
75abec1f70 include: Move lib/guestfs.h to include/guestfs.h
This brings libguestfs into line with other projects which have a
separate include/ directory for the public header.

It's also the case that <guestfs.h> has never particularly belonged in
the lib/ subdirectory.  Some tools add -Ilib/ but they only need
<guestfs.h> and not any other headers from that directory, and
separating out the public header allows us to clean those up.  This is
certainly the case for examples, and some language bindings and some
tests.

In future I'm hopeful we can use this as the basis to tease out other
dependencies, as a prelude to separating them out from the repo.
2020-09-21 18:38:28 +01:00
Richard W.M. Jones
3743cc89f6 golang: Capitalize fields in structs so they are publicly accessible.
See: https://github.com/libguestfs/libguestfs/issues/53
2020-09-21 10:56:29 +01:00
Yuri Chornoivan
fce82fe55a Fix minor typos 2020-08-24 16:24:38 +01:00
Pino Toscano
14ff95c511 po-docs: turn language list into LINGUAS file
Use a LINGUAS file with the list of available translations instead of
defining them in a make variable. This way Weblate will be able to
update the list using an available addon, and we do not need to list
those not built.

Accordingly, rename the variable with built languages to
'linguas_translated'.
2020-08-17 07:08:11 +02:00
Richard W.M. Jones
bd3fb65351 fish: Fix parsing of exportnames in NBD URIs.
https://github.com/NetworkBlockDevice/nbd/blob/master/doc/uri.md#nbd-uri-export-name
2020-08-16 11:02:42 +01:00
Weblate
b96c8f5146 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/
2020-08-13 11:59:02 +02:00
Weblate
48b0799297 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2020-08-13 11:56:56 +02:00
Pino Toscano
9a986ed60a Remove references to Zanata
We migrated to Weblate, and Zanata is being decommissioned.
2020-08-13 11:27:44 +02:00
Pino Toscano
049d83f6e4 po/po-docs: update catalog templates
Regenerate the catalog templates according to the updated extraction
rules (mostly fixed paths).
2020-08-13 11:27:44 +02:00
Pino Toscano
d3b43bb47a po-docs: fix references to sources
Start the message extraction from the toplevel source directory, so the
file references are relative to that, instead of relative to this
po-docs subdirectory.

Also update/regenerate podfiles accordingly.
2020-08-13 11:27:44 +02:00
Pino Toscano
a16f67e404 po: fix references to OCaml sources
Start the message extraction from the toplevel source directory, so the
file references are relative to that, instead of relative to this po
subdirectory.
2020-08-13 11:27:44 +02:00
Pino Toscano
bd896d68c0 po-docs: split pot and po handling
With the Weblate adoption, we let it update the po files from the
catalog template. The po4a behaviour of extracting the template,
merging the existing translations, and creating the translated PODs at
once is problematic. Hence, split the extraction and the translated POD
generation in two.

Use po4a-gettextize to extract the catalog template only, not doing it
anymore automatically at each build. There is no more need for a
po4a.conf file.

Use po4a-translate to create translated PODs from the po files, keeping
the fixup of the generated files (to avoid spurious =encoding, etc).
Add a silent rule to hide the po4a-translate command lines by default.

These changes also allow us to get rid of the POD existance checks with
associated error message pointing to the update-po rule. Now each
translated POD file is generated because of make dependency, and it
depends only on its po file.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-08-13 11:27:44 +02:00
Pino Toscano
3095825350 podfiles: add missing documentation 2020-08-13 11:27:44 +02:00
Pino Toscano
5be4970b1f po-docs: add missing dependencies for guestfish.1
The guestfish man page uses also additional POD snippets, so list them
as dependencies to make sure they are up-to-date.

This does not change the behaviour at the moment, however it will matter
when each traslated POD file will be generated on its own.
2020-08-13 11:27:44 +02:00
Pino Toscano
0dc0f87f20 po: remove rules for pot/po update
Weblate will handle the update of the po files from the translation
catalog, so avoid stomping on its feet by doing the same.

The translation catalog will be regenerated manually periodically.
2020-08-13 11:27:44 +02:00
Pino Toscano
eb7ba4b1d2 po: turn language list into LINGUAS file
Use a LINGUAS file with the list of available translations instead of
defining them in a make variable. This way Weblate will be able to
update the list using an available addon.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-08-13 11:27:44 +02:00
Andrey Shinkevich
3cad943a85 appliance: extract UUID from QCOW2 disk image
For the appliance of the QCOW2 format, the function get_root_uuid()
fails to get the UUID of the disk image.
In this case, let us read the first 256k bytes of the disk image  with
the 'qemu-img dd' command. Then pass the read block to the 'file'
command.

Suggested-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
2020-08-13 10:11:09 +01:00
Richard W.M. Jones
2469b4b790 rescue: Initialize roots.
Even though it seems clear from the code that roots cannot be used
uninitialized, GCC 10.1 cannot seem to work it out (possibly an LTO
bug).  Easiest way out here is to just initialize it.

rescue.c:396:37: error: 'roots' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  396 |     CLEANUP_FREE_STRING_LIST char **roots;
      |                                     ^
2020-08-01 07:33:45 +01:00
Richard W.M. Jones
0b8ef5a98d daemon/debug.c: Use __builtin_trap to cause segfault.
I couldn't get GCC 10.1 to ignore this warning any longer, possibly
because I am using LTO.  In any case dereferencing a pointer is
undefined behaviour, so let's use GCC's __builtin_trap() function
instead (also supported by clang).

debug.c: In function 'debug_segv':
debug.c:1002:8: error: null pointer dereference [-Werror=null-dereference]
 1002 |   *ptr = 1;
      |        ^
2020-08-01 07:27:17 +01:00
Richard W.M. Jones
599f2f7bd9 m4: Increase warning limit for frame-larger-than.
Generated code in virt-builder causes the error below.  Since we
cannot control what is generated by bison, increase the limit.

  CCLD     virt-index-validate
index-parse.c: In function 'yyparse':
index-parse.c:1857:1: error: the frame size of 5152 bytes is larger than 5000 bytes [-Werror=frame-larger-than=]
 1857 | }
      | ^
lto1: all warnings being treated as errors
lto-wrapper: fatal error: gcc returned 1 exit status
2020-08-01 07:09:52 +01:00
Richard W.M. Jones
5b29fba5b2 docs: Move shared POD for --keys-from-stdin to common code.
No functional change.
2020-07-30 14:06:45 +01:00
Richard W.M. Jones
eb78e990ac daemon, lib: Replace deprecated security_context_t with char *.
This gives deprecation warnings.  It always was simply a char *, and
the recommendation upstream is to replace uses with char *:

9eb9c93275
2020-07-30 13:58:35 +01:00
Richard W.M. Jones
224f373043 lib: Increase default memsize to 1280 (RHBZ#1837765).
Argon2 is the default LUKS Password-Based Key Derivation Function
(PBKDF) for some new guests such as RHEL 8.2 and Fedora.  It is
designed to be "memory hard", meaning that by design it requires large
amounts of memory, making it expensive to brute-force.  Unfortunately
the default for guests which had more than a few GB of RAM at install
time is to require about 1 GB of RAM to decrypt the block device,
which is considerably larger than the default available in the
libguestfs appliance.

To make it possible to open these encrypted disks we need to make the
appliance larger.  This could be done as a one-off, and the current
workaround is simply to set LIBGUESTFS_MEMSIZE=2048 or a similar
amount.  However since we don't know in advance whether we could be
dealing with an encrypted disk, partition, etc. or what PBKDF it uses,
the only way to deal with this in all circumstances is to increase the
default memsize.  This commit increases it quite a lot (768 -> 1280)
which is unfortunate.

Note as there is some confusion on this point: Since libguestfs does
not attempt to decrypt disks in parallel, you only need ~ 1GB in
total, not per encrypted disk.

For a reproducer, see:
https://bugzilla.redhat.com/show_bug.cgi?id=1837765#c14
2020-07-17 10:47:18 +01:00
Richard W.M. Jones
c5eec6c17b docs: Increase minimum version of Python to 3.6.
3.5 is needed to support type hints.

Debian oldstable has 3.5 (oldoldstable needed 3.4).
2020-07-06 20:37:51 +01:00
Sam Eiderman
66a5913462 python: Add type hints
Since support for python2 is dropped we can use the new python3 syntax
for type hints.

Signed-off-by: Sam Eiderman <sameid@google.com>
2020-07-06 20:35:58 +01:00
Richard W.M. Jones
dfe9fe8de8 Version 1.43.1. 2020-07-06 16:25:36 +01:00
Richard W.M. Jones
75def0ef18 python: Remove deprecated use of PyEval_ThreadsInitialized.
The correct/modern way to do this is:

https://docs.python.org/3/c-api/init.html#releasing-the-gil-from-extension-code

PyEval_ThreadsInitialized was deprecated in 3.9 and will be removed
completely in 3.11, so we shouldn't use that function.
2020-07-06 12:40:33 +01:00
Richard W.M. Jones
403d17a876 python: Drop support for Python 2.
Python 2 reached end of life on 2020-01-01:
https://python3statement.org/
https://pythonclock.org/

The minimum version required is now Python 3.4 (since that is the
version in Debian oldoldstable), but 3.6 is the minimum version that
I actually test.
2020-07-06 12:40:33 +01:00
Richard W.M. Jones
38e2ad1fbc builder: Update index file.
Fixes: commit 4837698d83.
2020-07-06 12:40:33 +01:00
Richard W.M. Jones
4837698d83 builder: templates: Add CentOS 8.2 and RHEL 8.2. 2020-06-16 12:51:09 +01:00
Richard W.M. Jones
6670dc0fbf builder: templates: Add centos-7.8, fedora-32, rhel-7.8.
Ubuntu 20.04 could not be built because their installer has changed in
a way which is not compatible with the current build script.  This
needs some work to fix.
2020-06-04 15:22:38 +01:00
Sergei Golovan
987734fcca erlang: Port to libei for Erlang 23
Replace the use of liberl_interface, which is removed in Erlang 23,
by libei. The implementation uses the ei_decode_iodata() function
which has been introduces only for Erlang 23, so it doesnt work with
earlier Erlang versions.
2020-06-04 13:49:35 +01:00
Pino Toscano
faa5d8507f sysprep: add Kerberos keytab file removal
This new operation removes the Kerberos /etc/krb5.keytab file from the
guest.

Thanks to Christian Heimes and François Cami for the hints.

Related to RHBZ#1789592.
2020-05-26 11:02:46 +02:00
Pino Toscano
0a53e2c7fc sysprep: add IPA offline unenrollment (RHBZ#1789592)
This new operation unenrolls the guest from a IPA server offline, by
removing the configuration files and certificates.

Thanks to Christian Heimes and François Cami for the hints.
2020-05-26 11:02:37 +02:00
Pino Toscano
b9065fa7ad sysprep: ca-certificates: request system CA store update
In case any certificate is removed from the guest, regenerate the system
CA store.
2020-05-07 14:05:09 +02:00
Pino Toscano
bb7fc6d0a1 sysprep: add a update_system_ca_store side effect
Add a simple side effect to make operation flag that a regeneration of
the system CA store is needed. In case it is flagged, regenerate the
system CA store directly, or using a firstboot script in case of
incompatible architectures.

This change is almost a no-op, since no operation requires the
regeneration of the system CA store yet.
2020-05-07 14:05:09 +02:00
Pino Toscano
b25e3495f5 customize: port do_run to run_in_guest_command
Make use of the new helper function in Tools_utils to run commands in
the guest.
2020-05-07 14:04:56 +02:00
Richard W.M. Jones
94ff24b880 appliance: Set default guestfs appliance path to $libdir/guestfs.
For unclear reasons this broke recently, although the breakage is only
reproducible in Fedora Koji.  It appears to be caused by the
calculation of the internal autoconf variable $acl_libdirstem
changing.  In the reproducer system:

checking for the common suffixes of directories in the library search path... lib,lib,lib64

On my local system:

checking for the common suffixes of directories in the library search path... lib64,lib64

My local system would be the correct one.  The actual code that
calculates this does some crazy stuff with ‘gcc -print-search-dirs’
which would hint that this output has changed in some way that subtly
breaks the generated configure script.  However even with match GCC
versions on my local system I could still not reproduce the issue.

None of this matters, as the easiest fix here is simply to stop using
internal autoconf variables at all.  I also added some AC_MSG_*
statements so we can more easily see what's going on in the configure
output.

Fixes commit 0f79400c7f.
2020-05-06 12:39:41 +01:00
Richard W.M. Jones
26324d5445 builder: templates: Add Ubuntu 20.04 code name (focal). 2020-05-05 22:23:49 +01:00
Richard W.M. Jones
a6ed62b0a6 builder: Fix all download.devel links.
All broken in early 2020 for no discernible reason.
2020-04-30 12:33:11 +01:00
Geoff Toole
ef2761eaa0 build: Fix linking of OCaml components when srcdir != builddir
ocaml-link.sh is a generated file, so run it from the build directory.
Remove it from EXTRA_DIST and also adjust docs/guestfs-hacking.pod
accordingly.
2020-04-20 09:31:35 +01:00
Richard W.M. Jones
c2c11382bb daemon: xattr: Filter out user.WofCompressedData from xattrs (RHBZ#1811539).
See comment in code for justification.

Thanks: Yongkui Guo for finding the bug.
2020-03-30 10:40:13 +01:00
Richard W.M. Jones
af8ed266a2 daemon: Add filter_list utility function.
For filtering lists of strings based on a predicate.
2020-03-30 10:40:13 +01:00
Richard W.M. Jones
5c175fe732 daemon: xattr: Refactor code which splits attr names from the kernel.
The kernel returns xattr names in a slightly peculiar format.  We
parsed this format several times in the code.  Refactor this parsing
so we only do it in one place.
2020-03-30 10:40:13 +01:00
Pino Toscano
088b6d1c80 get-kernel: fallback to uncompressed vmlinux kernels
In case the Linux guest has no compressed linux kernel (vmlinuz),
fallback to uncompressed ones (vmlinux).

Reported by: Laurent Vivier.
2020-03-12 13:52:17 +01:00
Pino Toscano
7265f08ce9 lib: remove extra @LIBS@ from pkg-config file
At the moment it is empty, so probably it does not exist. Remove it to
avoid adding spurious content to the pkg-config file in case that
variable will get a value in the future.
2020-03-12 11:45:30 +01:00
Richard W.M. Jones
bf61bf7355 build: Allow OCaml programs using libguestfs to be compiled against build dir.
You have to use:
  ../libguestfs/run ./configure
  ../libguestfs/run make

Use of the second ../libguestfs/run against make is unfortunate but I
believe it's unavoidable due to the way that ocamlfind works.
2020-03-12 10:08:23 +00:00
Richard W.M. Jones
e33b3c83a0 build: Allow C programs using libguestfs to be compiled against build dir.
We use a similar trick to libvirt to allow external C programs that
use libguestfs to be compiled against the built (but not installed)
libguestfs with:

  ../libguestfs/run ./configure
  make

What actually happens is we have a second pkg-config file
(lib/local/libguestfs.pc) which points to the locally built
libguestfs.  The ./run script sets up PKG_CONFIG_PATH to point to this
directory.  Assuming that ./configure is using pkg-config/pkgconf and
not some other half-baked solution it will pick up the libguestfs.pc
file from here which will set CFLAGS and LIBS appropriately.
2020-03-12 10:05:39 +00:00
Pino Toscano
b45b7cc08f builder: templates: add the AppStream repo
It is generally used together with BaseOS (which contains a restricted
set of packages), so add it to the preconfigured repositories by
default.
2020-03-12 10:13:03 +01:00
Richard W.M. Jones
31e6b18710 po: Remove virt-v2v related dependency from POTFILES-ml.
Causes this error if you compile libguestfs 1.42.0 from the tarball
without invoking the generator:

make[4]: *** No rule to make target '../common/mlv2v/uefi.ml', needed by 'libguestfs.pot'.  Stop.
2020-03-09 17:31:55 +00:00
Richard W.M. Jones
da6324ea31 Version 1.42.0. 2020-03-09 14:32:38 +00:00
Richard W.M. Jones
bfe98ffe13 Update release notes for 1.42.
Also update generator/authors.ml so that ‘make maintainer-check-authors’
passes.
2020-03-09 13:35:40 +00:00
Richard W.M. Jones
5a2b191de8 po-docs: Fix translation error in Ukrainian docs.
./uk.po:87712: 'msgid' and 'msgstr' entries do not both begin with '\n'
msgfmt: found 1 fatal error

Fixes commit 7a534669ae.
2020-03-09 13:35:40 +00:00
Richard W.M. Jones
786dba91d1 Revert "lib: Autodetect backing format and specify it explicitly."
This reverts commit 92fd5d5d40.

See discussion here:
https://www.redhat.com/archives/libguestfs/2020-March/thread.html#00041
2020-03-09 12:54:05 +00:00
Richard W.M. Jones
7a534669ae Update translations from Zanata (RHBZ#1787301).
This is before we move to Weblate.  See:
https://bugzilla.redhat.com/show_bug.cgi?id=1787301
2020-03-06 20:08:32 +00:00
Richard W.M. Jones
d107f12ac9 common: Update submodule to latest. 2020-03-06 19:41:02 +00:00
Richard W.M. Jones
0e17236d7d Update copyright dates to 2020. 2020-03-06 19:32:32 +00:00
Richard W.M. Jones
77f8018f6a Update gnulib to latest. 2020-03-06 19:03:03 +00:00
Richard W.M. Jones
18c3f40c60 appliance: Pass root=UUID=<uuid> instead of appliance device name (RHBZ#1804207).
Appliance device names are not reliable since the kernel no longer
enumerates virtio-scsi devices serially.  Instead get the UUID of the
appliance and pass this as the parameter.

Note this requires supermin >= 5.1.18 (from around July 2017).
2020-03-06 19:03:03 +00:00
Richard W.M. Jones
a06262e199 daemon: Print device names when they are translated.
This helps to debug problems with the new device name translation
code.  We can think about removing this later when the code is known
to work well.
2020-03-06 19:03:03 +00:00
Richard W.M. Jones
bca9b94fc5 daemon: Translate device names if Linux device ordering is unstable (RHBZ#1804207).
Linux from around 5.6 now enumerates individual disks in any order
(whereas previously it enumerated only drivers in parallel).  This
means that /dev/sdX ordering is no longer stable - in particular we
cannot be sure that /dev/sda inside the guest is the first disk that
was attached to the appliance, /dev/sdb the second disk and so on.

However we can still use SCSI PCI device numbering as found in
/dev/disk/by-path.  Use this to translate device names in and out of
the appliance.

Thanks: Vitaly Kuznetsov, Paolo Bonzini, Dan Berrangé.
2020-03-06 19:03:03 +00:00
Richard W.M. Jones
92fd5d5d40 lib: Autodetect backing format and specify it explicitly.
In the guestfs_disk_create API we have traditionally allowed you to
set backingfile without setting backingformat.  The meaning of this is
to let qemu autodetect the backing format when opening the overlay
disk.

However libvirt >= 6.0 refuses to even pass such disks to qemu (see
https://bugzilla.redhat.com/show_bug.cgi?id=1798148).

For this reason, move the autodetection earlier and make it explicit.
We now autodetect the format of the backing disk at the time of
creation of the overlay, and set that as the backing format in the
overlay disk itself, allowing libvirt to open the disk later.
2020-03-06 19:03:03 +00:00
Richard W.M. Jones
4e90febbaa RHEL 7: python: Check for _Py_IsFinalizing.
This symbol is not present in Python 2.7 or 3.6.  It's not really
necessary to call this, it just avoids a crash in certain corner cases
when the interpreter is shutting down.  So make the call conditional
on the function existing.

Fixes commit e6f9e0b0f6.
2020-03-06 18:59:52 +00:00
Richard W.M. Jones
6ff1055f40 daemon: 9p: modprobe 9pnet_virtio before 9pfs operations.
Recent Linux kernels seem to require this, for unclear reasons.
2020-03-06 14:50:37 +00:00
Richard W.M. Jones
0eb8d428a2 lib: Fix leak of XPath objects.
These are two unrelated leaks of XPath objects, both found by valgrind.

Fixes commit 9484136fd0
and commit 94843f155a.
2020-03-06 13:10:10 +00:00
Richard W.M. Jones
55401b3f89 valgrind: Add further suppressions for OCaml 4.10.
See also:
c260c25cf0
2020-03-06 12:24:48 +00:00
Richard W.M. Jones
3cea2cfe04 lib: Move guestfs_device_index impl from daemon to library.
This function doesn't work reliably with the proposed change to device
name translation.  The reason is that strings returned by
Devsparts.list_devices contained translated names, so their indexes
did not correspond to the untranslated names used outside the
appliance..

We can avoid this and make the function much simpler and faster by
implementing it on the library side instead.
2020-03-05 13:18:27 +00:00
Richard W.M. Jones
eb17229c3e tests/disks: Don't segfault if guestfs_list_devices returns an error.
Although it's highly unlikely in normal use, while testing device name
translation patches it did happen and caused the test to segfault
instead of exiting with an error.
2020-03-05 12:08:35 +00:00
Richard W.M. Jones
2639de38c1 todo: Remove virt-rescue suggestion which has been done. 2020-03-05 12:02:14 +00:00
Martin Kletzander
8339f766d7 Update the 5 year logo to 10 year logo
Already outdated, but rounded ;)

I literally just opened the 5yrs logo, changed the text and then done:

  inkscape -z -o logo/fish-10yrs.{png,svg}
  cp {logo,website}/fish-10yrs.svg

and then updated the rest of the files.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2020-03-05 10:38:41 +01:00
Pino Toscano
b6bead0097 filesystems: fix size reporting for filesystems
The current way to get the size of a filesystem is to query the size in
bytes of the device. However, this gives the whole size of the device
where a filesystem is stored, and it does not consider the actual size
for which the filesystem is configured (e.g. in case it was shrunk).
A simple reproducer for this is:
$ guestfish -N test.img=fs:ext4:2G resize2fs-size /dev/sda1 1073741824

As result, try to mount the filesystem, and get its actual statistics to
determine its full size. In case mounting fails, fall back to the
previous method, which is still a good value in the majority of the
cases.

Thanks to: Erik Skultety.
2020-02-27 10:25:54 +01:00
Richard W.M. Jones
1e180cb9fd Update common submodule to latest. 2020-02-26 09:48:45 +00:00
Nikolay Ivanets
d9b4e3086e virt-make-fs: add '--blocksize' option support
This patch adds '--blocksize' command line option for virt-make-fs
tool.  This option allows specifying disk sector size as described in
'guestfs_add_drive_opts' libguestfs API.
2020-02-24 20:48:33 +00:00
Daniel P. Berrangé
7db041a660 docs: fix instructions for building from git
On current Fedora releases the ocaml modules will fail to
link unless CFLAGS contains -fPIC.

The autogen.sh script only updates the 'gnulib' submodule,
and so the build will fail due to the missing 'common'
submodule. This needs to be manually initialized at checkout.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-02-24 13:25:59 +00:00
Martin Kletzander
c7d7b25524 mlcustomize: Trim whitespaces from commands read from file (RHBZ#1351000)
The first split does not care about the whole string, it is just trying to get
the command name in front, so triml is just right.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2020-02-24 13:14:46 +01:00
Richard W.M. Jones
ab4e4af090 Update common submodule. 2020-02-24 11:12:10 +00:00
Csaba Henk
83474887ed ruby: change value of 'readonly' drive toption to Boolean in doc/example/test
Seeing `g.add_drive_opt :readonly => 1` allows one to imply
that ensuring writable access to drive should happen via
`g.add_drive_opt :readonly => 0`. However, the passed option
value gets passed down to C according to Ruby Boolean semantics,
that is, any value apart from `false` and `nil` will be true
(see RTEST in Ruby C API).

So its more idiomatic and provides a better hint if we use
`g.add_drive_opt :readonly => true` in Ruby samples.
2020-02-19 18:27:02 +00:00
Richard W.M. Jones
b68a67e1a9 Revert "golang: Don't run launch test if appliance has not been built."
This causes a strange error with modern golang:

  go: parsing $GOFLAGS: non-flag "appliance"

This reverts commit d57d8f22de.
2020-02-19 18:24:51 +00:00
Csaba Henk
95244fd2ca golang: make API idiomatic so that functions return (<val>, error)
Go API functions returned (<val>, *GuestfsError) that made
code like this fail to build:

    n, err := os.Stdin.Read(buf)
    if err != nil {
        log.Fatal(err)
    }
    n, err = g.Pwrite_device(dev, buf[:n], off)
    ...

As err should be of error (interface) type as of the stdlib call,
and should be of *GuestfsError type as of the libguestfs call.

The concrete error value that libguestfs functions return can be
a *GuestfsError, but the function signature should have (<val>, error)
as return value.
2020-02-19 18:12:15 +00:00
Nikolay Ivanets
c509420be7 virt-get-kernel: add '--blocksize' option support
This patch adds '--blocksize' command line option for virt-get-kernel
tool.  This option allows specifying disk sector size as described in
'guestfs_add_drive_opts' libguestfs API.
2020-02-17 18:04:11 +00:00
Richard W.M. Jones
e6764a5415 appliance: Add ntfs-3g-system-compression (RHBZ#1703463).
This package in Fedora enables optional support for Windows 10
"CompactOS" (file-level compression), read-only, which is sufficient
for inspecting Windows guests and doing certain types of modifications
to them.  Virt-v2v appears to work, but it may be that anything that
involves modifying a compressed file might not work.

I couldn't find the equivalent package in Debian or SUSE.  It's
available in Arch AUR although I didn't verify that part of the change
actually works there (but should be safe because supermin ignores
packages that are not known about on the target system).
2020-02-17 12:38:27 +00:00
Nikolay Ivanets
6b6bb44ebc tools: add '--blocksize' option for C-based tools
This patch adds '--blocksize' command line option for guestfish and
other C-based tools.  This option allows specifying disk sector size.
2020-02-17 12:32:03 +00:00
Nikolay Ivanets
94843f155a lib: add support for disks with 4096 bytes sector size
Nowadays there are hard drives and operating systems which support
"4K native" sector size.  In this mode physical and logical block size
exposed to the operating system is equal to 4096 bytes.

GPT partition table (as a known example) being created in this mode will
place GPT header at LBA1 which is 4096 bytes.  libguetfs is unable to
recognize partition table on such physical block devices or disk images.
The reason is that libguestfs appliance will look for a GPT header at
LBA1 which is seen at 512 byte offset.

In order to fix the issue we need a way to provide correct logical block
size for attached disks.  Fortunately QEMU and libvirt already provides
a way to specify physical/logical block size per disk basis.

After discussion in a mailing list we agreed that physical block size is
rarely used and is not so important.  Thus both physical and logical
block size will be set to the same value.

In this patch one more optional parameter 'blocksize' is added
to add_drive_opts API method.  Valid values are 512 and 4096.

add_drive_scratch has the same optional parameter for a consistency and
testing purpose.

add-domain and add_libvirt_dom will pass logical_block_size value from
libvirt XML to add_drive_opts method.
2020-02-11 15:20:09 +00:00
Richard W.M. Jones
815eab8a66 tests: Use explicit backing format for all backing disks.
Libvirt 6.0 now requires that every disk in the backing chain has an
explicit backing format.  For example this will be rejected by
libvirt:

  qemu-img create -f qcow2 -b backing-disk disk.qcow2

with the error:

  Original error from libvirt: Requested operation is not valid:
  format of backing image 'backing-disk' of image 'disk.qcow2' was not
  specified in the image metadata (See
  https://libvirt.org/kbase/backing_chains.html for troubleshooting)
  [code=55 int1=-1]

Instead you have to use the -F option to specify the format, eg:

  qemu-img create -f qcow2 -b backing-disk -F raw disk.qcow2
2020-02-06 16:06:19 +00:00
Daria Phoebe Brashear
56834875b2 properly initialize error_data_lock_list before use
when a handle is allocated, the error_data_list_lock must be initialized
2020-02-06 13:23:31 +00:00
Richard W.M. Jones
d6fcf519f2 builder: Fix const correctness for OCaml 4.10.
String_val now returns a const char *.
2020-02-06 10:33:39 +00:00
Richard W.M. Jones
9f3148c791 ocaml: Use caml_alloc_initialized_string instead of memcpy.
See this commit in libguestfs-common:
398dc56a6c
2020-02-06 10:32:08 +00:00
Richard W.M. Jones
378b49152d m4: ocaml: Move definition of HIVEX_OPEN_UNSAFE_FLAG closer to test.
Minor code cleanup, no change in semantics.
2020-02-06 10:28:34 +00:00
Richard W.M. Jones
4e199494c4 cat: Fix GCC 10 warning.
I believe this warning is bogus, but simply initializing the local
variable is enough to avoid it.

log.c: In function 'do_log':
log.c:390:7: error: 'comm_len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  390 |       printf (" %.*s", (int) comm_len, comm);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-02-06 10:28:34 +00:00
Pino Toscano
b3ef101a0f daemon: fix/enhance error reporting of Augeas exceptions
The current code was broken, as the field 1 of the exception value is
the error code (int), not an error string, and thus it would have
crashed.  This did not happen in practice, as all the usage of
ocaml-augeas were only in the inspection code with ad-hoc exception
catching blocks.

Other than fixing the aforementioned issue, enhance the error reporting
to be as close as possible to what the current AUGEAS_ERROR() macro
does: error message, error minor message (if available), error details
(if available).
2020-01-27 14:53:35 +01:00
Richard W.M. Jones
a883a2f0c9 Update BUGS and PO files. 2020-01-22 13:07:08 +00:00
Richard W.M. Jones
d4a1c3a778 build: Add build-aux/config.rpath from gettext.
This is somehow required after updating gnulib.  I lack the energy to
find out exactly why, but this fixes it.
2020-01-22 13:07:01 +00:00
Richard W.M. Jones
538f728d5f Update gnulib. 2020-01-22 13:03:03 +00:00
Richard W.M. Jones
f7bb3eef19 Update common submodule. 2020-01-22 13:03:03 +00:00
Richard W.M. Jones
bd4d9264e5 docs: Update release notes in preparation for 1.42 release. 2020-01-22 13:03:03 +00:00
Richard W.M. Jones
54ccd4fee9 docs: Document that Python 2.7 or above is now required.
Updates commit 444750bfd1.
2020-01-22 10:45:37 +00:00
Pino Toscano
a754cd4307 launch: libvirt: use machine type when querying for domcaps
On some architectures a certain machine type is used, so use it when
querying the libvirt domain capabilities.
2020-01-20 13:00:12 +01:00
Pino Toscano
e636e64d34 lib: uefi: use the efi libvirt firmware if available
In case libvirt supports the firmware autoselection and there is an EFI
firmware available, use it directly instead of handling the firmware
manually.
2020-01-20 13:00:12 +01:00
Pino Toscano
029901113c lib: allow to use libvirt firmware autoselection
Enhance the UEFI firmware lookup function with the information on the
libvirt firmware autoselection, allowing it to return a value to use for
the appliance.

At the moment no firmware is selected this way, so there is no behaviour
change.
2020-01-20 13:00:06 +01:00
Pino Toscano
777a21b16b lib: uefi: reset out parameters earlier
Make sure they are always reset, no matter the code branches later on.

This is mostly code motion.
2020-01-20 13:00:06 +01:00
Pino Toscano
9484136fd0 launch: libvirt: parse firmware autoselection
Parse from the domain capabilities whether libvirt supports the
autoselection of firmware, and which values are supported.
2020-01-20 13:00:06 +01:00
Pino Toscano
5d8cca738e build: define HAVE_PYCODESTYLE in all the cases
Fixes commit cad3ea9e74 in case Python is
disabled, or not available.
2020-01-16 11:02:25 +01:00
Richard W.M. Jones
711fab172c ocaml: Fix test for -runtime-variant _pic.
This fails with Fedora 32, and possibly earlier versions:

  checking if OCaml ‘-runtime-variant _pic’ works... no

The reason is:

  $ ocamlc -runtime-variant _pic test.ml -o test
  File "test.ml", line 1:
  Error: Cannot find file camlheader_pic

which may even be a packaging error in the Fedora package.  However it
makes no sense to test the bytecode compiler since we don't use it on
any architecture we care about and bytecode doesn't even contain a
linked runtime.  Changing the test to use ocamlopt instead of ocamlc
fixes the problem.
2020-01-15 12:52:29 +00:00
Pino Toscano
cad3ea9e74 python: add a pycodestyle test
Look for pycodestyle, and use it to check all the Python sources (tests
and auxiliary scripts included) of the Python bindings.
2020-01-14 16:21:22 +01:00
Pino Toscano
da4c7f9112 python: skip line length check in license line
Properly mark the long line with the license classifier in setup.py:
the classifier is long on its own, and changing the code to stay within
79 characters would result in worse code.
2020-01-14 16:21:22 +01:00
Pino Toscano
92759efbf5 python: improve errors in inspect_vm example
When validating user input, print an error message and exit, instead of
either asserting or raising a non-existing exception.
2020-01-14 16:21:22 +01:00
Pino Toscano
7d0f8e1b22 python: tests: remove unused imports
No functional changes.
2020-01-14 16:21:22 +01:00
Pino Toscano
4719cca7f5 python: tests: improve variable naming
Use a slightly more descriptive name, as also pointed out by
pycodestyle.

No functional changes.
2020-01-14 16:21:22 +01:00
Pino Toscano
6d0e9531c8 python: tests: catch specific exception
When trying to import libvirt, catch the specific exception that is
raised when an importing fails.
2020-01-14 16:21:22 +01:00
Pino Toscano
0703ec9c8c python: PEP 8: adapt whitespaces in lines
Fix continuation indentation, and whitespaces around operators.

This is just code reformatting, with no behaviour changes; no content
changed beside whitespaces, so "git diff -w" gives an empty diff.
2020-01-14 16:21:22 +01:00
Pino Toscano
df3e693b1b python: PEP 8: adapt empty lines
Add or remove empty lines to match the needed ones around
blocks/functions/etc.

Adapt the generation of guestfs.py to emit the separating empty line
before adding a new function/alias, rather than after it.

This is just formatting, no behaviour changes.
2020-01-14 16:21:22 +01:00
Pino Toscano
40251e4b3c python: replace guestfs_int_py_fromstringsize in Py2 branches
In Python 2 code branches use PyString_FromStringAndSize directly
instead of the guestfs_int_py_fromstringsize wrapper (which calls
PyString_FromStringAndSize anyway on Python < 3).
2020-01-09 17:49:16 +01:00
Pino Toscano
a68a0298b5 python: remove compile time check for PyString_AsString
The PyString API is specific to Python < 3, replaced by PyBytes and
PyUnicode in Python 3+; hence, drop the compile time check, and use the
right API depending on the Python version.
2020-01-09 17:45:26 +01:00
Pino Toscano
c3728416fb python: assume support for Capsules
They were introduced in Python 2.7 and 3.1, so we can assume they exist
(as Python 2.7 is the minimum version required, and 3.0 is long gone).
2020-01-09 17:29:15 +01:00
Pino Toscano
444750bfd1 python: drop code for Python < 2.5
Python >= 2.7 is required.
2020-01-09 17:22:16 +01:00
Pino Toscano
d8cb64dbe7 build: enforce a minimum Python version
In case the Python bindings are enabled, enforce a minimum version.
Set this minimum version to 2.7, as it has been de-facto for a while
now.
2020-01-09 17:15:20 +01:00
Pino Toscano
2c4aec6dcf build: update miscellaneous files
C_SOURCE_FILES
POTFILES

Followup of commit cb0edd4354.
2020-01-09 15:47:56 +01:00
Pino Toscano
eb43478f83 inspect: avoid returning "unknownX.Y" for unknown Linux distros
If it is not possible to detect the distribution of a Linux OS, do not
propose "unknownX.Y" (where X is the major version number, and Y the
minor) as short osinfo ID. Just return "unknown" instead.
2020-01-09 14:57:59 +01:00
Pino Toscano
cb0edd4354 build: use split stringlist functions from common/utils
The OCaml and Python bindings directly use the utils.c source in
common/utils, mostly for guestfs_int_free_string_list.  That source
contained also functions using gnulib functions, however without
linking to gnulib.  When building with default build flags (e.g. without
as-needed mode), the gnulib symbols cannot be resolved, leading to
unusable OCaml and Python libraries.

As solution, update the common submodule to get the split of the split
of the stringlist functions in common/utils, and adapt the OCaml and
Python bindings:
- both now use stringlists-utils.c instead of utils.c
- fix the Python distutils setup to include only the sources really
  needed
2020-01-09 14:57:38 +01:00
Pino Toscano
e789a070de python: remove also __pycache__ directories on clean 2019-12-19 15:34:37 +01:00
Pino Toscano
a420e535d5 daemon: reorder internal static libs to fix linking
Move the interal static libraries as the last items in the list of
libraries of guestfsd, to make sure their symbols are used for all the
other libraries.  This is because GCC resolves the symbols looking at
the arguments from the beginning to the end of the command line.
This currently does not cause failures, however it "just works" because
of the tricky situation set up.

The situation is the following:

1) common/utils contains few utility sources: one of them is utils.c,
which contains various functions -- for example
guestfs_int_free_string_list and guestfs_int_drive_name --, it is built
as utils.o, and bundled in the static library libutils.a

2) common/mlutils builds a OCaml library with bindings for some utility
functions in libutils.a, in particular guestfs_int_drive_name (but not
guestfs_int_free_string_list); there are two versions of this library,
one OCaml library (dllmlcutils.so) that links with libutils.a, and one
static library (libmlcutils.a), which cannot specify the libraries it
links to (as it is static)

3) when the daemon is linked, the command line was the following
(simplified):
  $ gcc [...] -o guestfsd guestfsd-9p.o other_daemon_object.o [...] \
      ../common/utils/.libs/libutils.a [...] -lmlcutils [...]
Some of the objects of the daemon itself use
guestfs_int_free_string_list, and thus the compiler opens libutils.a
(it is after the objects in the command line) and picks utils.o, which
contains also guestfs_int_drive_name (not used directly in the daemon);
when linking later on with libmlcutils.a, the symbols for this static
library (like guestfs_int_drive_name) are already resolved, and thus
all the symbols are resolved, and the linking succeeds

This fragile situation can be easily broken by moving e.g.
guestfs_int_drive_name out of common/utils/utils.c to a new source (say
utils2.c) still built as part of libutils.a: since nothing before
-lmlcutils actually needs to pick utils2.o from libutils.a for symbols,
then GCC will not be able to resolve all the symbols in libmlcutils.a.

As solution, move libutils.a (and other internal static libraries) as
last libraries to link guestfsd to: this way, GCC knows where to find
all the symbols needed by all the objects and libraries specified in
the command line.
2019-12-19 13:10:41 +01:00
Pino Toscano
d8540adffb inspect: document OpenMandriva Lx as detected distro
Also extend the virt-inspector RNG schema to allow it.

Followup of commit a4ef6716b4.
2019-12-18 13:14:59 +01:00
Pino Toscano
1cc8293935 po: reduce the list of extracted sources
Prune from the list of sources where to extract messages various sources
with no messages:
- .pl and .pm files, as they do not contain messages: almost all the
  .pl files are tests, and the only .pm file is the Perl Sys::Guestfs
  module, which wraps the XS extension
- dummy.c sources; they are empty sources used to build OCaml-only
  targets using automake
- gperf generated sources
- C/OCaml tests
2019-12-18 11:06:40 +01:00
Pino Toscano
98700b6d8c docs: exclude dummy.c sources
They are empty sources used to build OCaml-only targets using automake,
so there is no documentation to extract.
2019-12-18 11:01:58 +01:00
Pino Toscano
af3b8624b7 build: exclude common/mlv2v from distcheck
It is part of the common submodule but not used in libguestfs, so it is
not included in distribution tarballs.
2019-12-17 16:31:09 +01:00
Pino Toscano
4cd801dcff build: fix make implicit dependencies on ml/mli files
As proposed in the Debian bug #946594 [1], the implicit .cmi/.cmo/.cmx
dependencies are tied to files in the source directory only, and thus
they break when either the .ml or the .mli files are in the build
directory. Since there is already VPATH set up by automake, rely on it
to locate the right source.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=946594#36

Solution proposed by Vincent Danjean, thanks!

This reverts commit 802c5d2055 in this
file.
2019-12-17 15:38:00 +01:00
Pino Toscano
78a18b20e1 tests: fix srcdir references
Make sure to properly reference to files in the source directory.
2019-12-17 15:33:21 +01:00
Pino Toscano
dd99b6f68d inspector: ship the actual test script
It is no more generated by configure now; fixes
commit 68f5c27ada.
2019-12-17 12:28:02 +01:00
Pino Toscano
957549cd2d Remove mlaugeas and mllibvirt leftovers
Update according to the removal of the embedded copies of augeas-ocaml,
and libvirt-ocaml from the common submodule.
2019-12-16 18:55:01 +01:00
Pino Toscano
3c8e7e41db Update common to latest 2019-12-16 18:46:44 +01:00
Pino Toscano
fb7e21be96 build: switch embedded copy of ocaml-augeas
Use the newer copy shipped locally as bundled, instead of the one in
the common submodule, as the latter copy will go away soon.
2019-12-16 18:33:49 +01:00
Pino Toscano
c93cc14b9f Bundle the ocaml-augeas library for use by libguestfs
Add a copy of the libvirt-ocaml library, currently available at:
  http://git.annexia.org/?p=ocaml-augeas.git;a=summary
This is a snapshot at commit 1cf5aef99b26a46529ca797547c0b49627fffe78,
which has all the features we need (and that builds fine).
It is expected to stay synchronized with upstream, until there is a new
upstream release, and it will be widespread enough.
2019-12-16 18:30:08 +01:00
Pino Toscano
68f5c27ada tests: switch to config.sh for xmllint
Instead of generating test scripts from configure with the path of
xmllint, export that path in config.sh, so the tests can be static
scripts again.
2019-12-16 11:19:00 +01:00
Pino Toscano
54a9d04f72 build: add an empty config.sh
This helper script will contain variables with results of configure
checks, so other scripts can source it.

Source it automatically in test-functions.sh, so every test can already
make use of it.
2019-12-16 10:48:14 +01:00
Pino Toscano
c9bd101383 Update common to latest 2019-12-13 16:07:51 +01:00
Pino Toscano
062e1bd26e rust: fix list of generator-built files
src/lib.rs is not created by the generator, while src/guestfs.rs is.
2019-12-12 18:01:32 +01:00
Pino Toscano
d44ef6aa50 rust: fix path to lib.rs
It is a source file, so explicitly look for it in the source directory.
2019-12-12 18:01:32 +01:00
Pino Toscano
21ef7adb37 perl: fix path to Build.PL
It is a generated file, so it is in the build directory.
2019-12-12 18:01:32 +01:00
Pino Toscano
7ced2b9354 generator: do not generate mlv2v files when not needed
mlv2v is not shipped with libguestfs, so do not try to generate the
files for it in case generator is invoked on a release tarball.
2019-12-12 18:01:32 +01:00
Pino Toscano
e17f9f43fd docs: fix out-of-source documentation build
Invoke make-internal-documentation.pl by its path in the source
directory.

Also, depend on it to regenerate the documentation in case
make-internal-documentation.pl changes.
2019-12-12 18:01:32 +01:00
Pino Toscano
323909d92e build: stop shipping files generated by configure
They will be generated by configure.
2019-12-12 18:01:32 +01:00
Richard W.M. Jones
5469db383a builder: templates: Build RHEL 8.1 image internally. 2019-12-12 15:22:50 +00:00
Pino Toscano
ebcd915997 docs: remove utils files
They were moved to a different repository.

Follwup of commit 58ab39ba34.
2019-12-12 13:54:36 +01:00
Pino Toscano
c37673eaea tests: fix podcheck tests
Pass to the various podcheck invocations the paths with POD files that
are included.

Followup of commit 46e59e9535.
2019-12-11 14:24:01 +01:00
Pino Toscano
b8f9bb3092 podcheck: __INCLUDE:file.pod__ and __VERBATIM:file.txt__ in POD files.
Make sure the pod checker script can deal with the newer additions of
podwrapper.pl.

Followup of commit 46e59e9535.
2019-12-11 14:20:37 +01:00
Pino Toscano
8bd80847fe inspect: correct osinfo ID for CentOS >= 8
CentOS 8 is represented with a simpler "centos8" osinfo ID.
2019-12-11 13:35:30 +01:00
Richard W.M. Jones
b6e5abd7e4 Update common to latest.
Resynch with upstream ocaml-augeas so libguestfs can be built with
OCaml 4.09.0.
2019-12-11 11:43:39 +00:00
Pino Toscano
4aa4edf972 ocaml: add handling for errno ENOSPC 2019-11-29 13:16:32 +01:00
Pino Toscano
355bed63f4 tests: test --key for a real guest (with inspection)
Test both the decryption by device name, and UUID.
2019-11-29 13:03:20 +01:00
Pino Toscano
206ce8bbf1 New API: luks_uuid
Return the UUID of a LUKS device.
2019-11-29 12:04:55 +01:00
Richard W.M. Jones
58ab39ba34 Remove boot and qemu analysis tools into a separate project.
These have now moved here:
https://github.com/libguestfs/libguestfs-analysis-tools

This commit removes them and updates guestfs-performance(1) to point
to the new location.
2019-11-28 15:37:31 +00:00
Richard W.M. Jones
8ba0457e9e options: Update documentation for --key SELECTOR.
Use the common/options/key-option.pod fragment to document the --key
option and selector instead of duplicating the same documentation
everywhere.
2019-11-28 13:28:49 +00:00
Richard W.M. Jones
152ff05ae0 fish: Update documentation to use new __INSERT:...___ directive. 2019-11-28 13:28:49 +00:00
Richard W.M. Jones
46e59e9535 podwrapper: __INCLUDE:file.pod__ and __VERBATIM:file.txt__ in POD files.
The current method of adding multiple --insert or --verbatim
parameters to the podwrapper command is not very easy to use because
it involves modifying the Makefile.am in every place where this is
used, plus under po-docs/$language/Makefile.am.  It's better if the
POD file itself can do the inclusion.

This enhances support so that the special sequences

  __INCLUDE:file.pod__

or

  __VERBATIM:file.txt__

are treated as file inclusion.

The filename must be a plain file and is searched along a path
(supplied by the optional podwrapper --path parameter).  The purpose
of the path is to allow translations to happen more easily.  For
example we can include a particular POD fragment from common/options/
for the English version, but copy the translated file to
po-docs/$language/ for every translated version.
2019-11-28 13:28:49 +00:00
Pino Toscano
08481e05d0 build: ignore unused submodules
Do not build the mlv2v, and mllibvirt submodules, as they are not used.
2019-11-28 13:09:21 +01:00
Pino Toscano
72d83cc6eb build: remove unused gnulib modules
Remove gnulib modules that provide stuff clearly not used within
libguestfs (library, daemon, and C tools).  Among directly and
indirectly modules used previous (and now no more), they are:

  cycle-check
  d-ino
  dev-ino
  dup3
  dup3-tests
  fcntl-safer
  fcntl-safer-tests
  fdopendir
  fdopendir-tests
  filevercmp
  filevercmp-tests
  ftell
  ftell-tests
  ftello
  ftello-tests
  fts
  getaddrinfo
  getaddrinfo-tests
  getcwd
  getcwd-tests
  gnu-make
  hostent
  i-ring
  i-ring-tests
  iconv
  iconv-tests
  inet_ntop
  inet_ntop-tests
  isatty
  isatty-tests
  openat-safer
  openat-safer-tests
  opendirat
  ptsname_r
  ptsname_r-tests
  read-file
  read-file-tests
  rewinddir
  servent
  ttyname_r
  ttyname_r-tests
  xgetcwd

Some of the removed modules are still used pulled indirectly as
dependency of other modules.  There should be no behaviour change on
recent Linux distros, although older distros were not tested (adding
a module back is easy, anyway).

Remove accordingly unused automake variables, and ignored files.
2019-11-28 13:09:21 +01:00
Pino Toscano
86d5ddc296 daemon: remove unused include 2019-11-28 13:09:21 +01:00
Pino Toscano
b87e20ccf1 daemon: switch from read_file to read_whole_file
Since we have already an helper to read a file, use it instead of the
gnulib function.
2019-11-28 13:09:21 +01:00
Pino Toscano
73a58394a9 daemon: move read_whole_file to common utils
Move the read_whole_file function to the common utilities of the daemon,
so other parts can use it.  For this purpose, add an out parameter to
get the amount of bytes read.

Except from the parameter addition, this should be just refactoring.
2019-11-28 13:09:21 +01:00
Pino Toscano
a2b37a495c tests: switch away from xgetcwd
xgetcwd is used only in a test, so there is no need to pull a gnulib
module just for it.

Switch to use getcwd directly with a fixed buffer: the tests would have
failed with paths longer than 992 characters, as the libvirt_uri would
have been truncated.  Since there were no reports of issues, we can
assume that the current working directory will fit in 1024 characters;
adapt the size of libvirt_uri accordingly.
2019-11-28 13:09:21 +01:00
Richard W.M. Jones
38ff3354ea tests: luks: Test the --key options.
Previously untested, and as always happens they were quite buggy.
2019-11-28 10:13:57 +00:00
Richard W.M. Jones
a7ed7752cf Version 1.41.8. 2019-11-19 16:18:03 +00:00
Richard W.M. Jones
31272305fa po-docs: Remove virt-v2v man pages.
Fixes commit 85c99edec1.
2019-11-19 15:56:03 +00:00
Richard W.M. Jones
43e44477ec po-docs: Split language release notes by release too.
Fixes commit e9eaf4d889.
2019-11-19 15:49:53 +00:00
Sam Eiderman
e6f9e0b0f6 python: Don't call Python functions if Python interpreter has already gone.
If you've registered a callback in Python and the handle is implicitly
closed when the Python interpreter exits, then it can be that the
following happens:

 - Python interpreter is finalized.
 - guestfs_close is called
 - callback is invoked (eg. close event or to display a debug message)
 - Python code runs from the callback wrapper

This cause a segfault on shutdown.  Catch this case and stop the
callback from running (we lose the event but given the above sequence
of events there's not much we can do about it).

See:
https://bugzilla.redhat.com/show_bug.cgi?id=1773520#c7
2019-11-18 15:35:17 +00:00
Sam Eiderman
7757eb8d0c Python: Fix GIL usage in guestfs_int_py_event_callback_wrapper (RHBZ#1773520)
All Py_* functions should be protected by the GIL.
Otherwise internal python data structures can get corrupted.

Move PyGILState_Ensure to the beginning of the block and
PyGILState_Release to the bottom.

Signed-off-by: Sam Eiderman <sameid@google.com>
2019-11-18 15:30:01 +00:00
Richard W.M. Jones
62c36fa297 Update common to latest. 2019-11-16 08:38:51 +00:00
Richard W.M. Jones
bd42180006 Version 1.41.7. 2019-11-13 12:49:55 +00:00
Richard W.M. Jones
85c99edec1 v2v: Remove virt-v2v.
It has moved to a new repository:
https://github.com/libguestfs/virt-v2v
2019-11-13 12:49:55 +00:00
Richard W.M. Jones
ededdce3c1 autogen: Fix detection of gnulib submodule status.
Don't require a rebuild every time the common module changes status.
2019-11-13 12:49:54 +00:00
Richard W.M. Jones
e9eaf4d889 docs: Split release notes by release.
See analogous change in nbdkit for the rationale:

98395d6f7a
2019-11-13 12:49:54 +00:00
Richard W.M. Jones
7c05fc91dc website: Update builder index with fedora-31.
Updates commit 9c693ca0e8.
2019-11-12 12:28:36 +00:00
Richard W.M. Jones
9c693ca0e8 builder: templates: Add Fedora 31. 2019-11-12 09:58:46 +00:00
Richard W.M. Jones
696b1b059a common: Update to latest. 2019-10-16 14:39:31 +01:00
Richard W.M. Jones
8097dc16e7 Version 1.41.6. 2019-10-15 13:34:40 +01:00
Richard W.M. Jones
435b70f564 customize, v2v: Remove existing file before copying.
The generator creates these files with 0444 mode, so they cannot be
overwritten by a simple ‘cp’ command.  We could use ‘cp -f’ or ‘rm -f’.

Fixes commit 15394cb4dd.
2019-10-15 13:34:39 +01:00
Richard W.M. Jones
8f3210c875 Replace common/ with git submodule.
This directory contains code which is shared between libguestfs and
the tools.  It now points to a new repository:

https://github.com/libguestfs/libguestfs-common
2019-10-15 13:34:39 +01:00
Richard W.M. Jones
15394cb4dd common/{mlcustomize,mlv2v}: Add generated files to git.
With the proposed split we will only run the generator from the
libguestfs repo.  When compiling virt-v2v or the guestfs-tools we will
need certain generated files to be present already in the
libguestfs-common repo, and therefore these files must be added to
git.  Hopefully they won't change very often.
2019-10-14 19:38:36 +01:00
Richard W.M. Jones
20c2dfbe00 generator, customize, v2v: Only place generated files in libguestfs or common.
After the proposed split of the libguestfs repo, we will end up with
the following layout:

  libguestfs.git
      common -> git submodule libguestfs-common.git
      generator

  virt-v2v.git
      common -> git submodule libguestfs-common.git

  guestfs-tools.git
      common -> git submodule libguestfs-common.git

The generator will only be able to write to libguestfs directories and
the common directory/submodule.  This is mostly the case already with
only 6 exceptions:

  customize/customize-options.pod
  customize/customize-synopsis.pod
  customize/customize_cmdline.ml
  customize/customize_cmdline.mli
  v2v/uefi.ml
  v2v/uefi.mli

This commit moves these files around so they appear under common/ml*

It is somewhat unsatisfactory because it involves copying files
around, but there are some mitigating factors:

(1) Any changes now give us more freedom to develop faster and thus
clean things up in future.

(2) The v2v/uefi files ought to go away in future anyway.

This is simple code motion and should have no effect on the built
programs or tests.
2019-10-14 18:37:29 +01:00
Richard W.M. Jones
a07b9a2cda v2v: virt-v2v doesn't need to link directly with -lutils.
It is linked indirectly via mlcutils.cmxa.
2019-10-14 15:28:28 +01:00
Richard W.M. Jones
ddfec6a97d customize: Move Firstboot and SELinux_relabel modules to common/mlcustomize.
These two modules are a dependency of virt-v2v.  Since we intend to
split virt-v2v from the other OCaml virt-* programs, we cannot have a
dependency between virt-v2v and virt-customize.  Instead we must move
the modules to a common directory (common/mlcustomize) and have both
tools depending on the modules from there.

This is simple refactoring and should not affect how the programs work
or are tested.
2019-10-14 12:36:47 +01:00
Richard W.M. Jones
a1c036b4a6 .gitignore: Ignore website/download/builder/*.xz.
This makes it easier to run the slow tests by copying the virt-builder
templates into this directory.
2019-10-14 12:36:47 +01:00
Richard W.M. Jones
b85dd3dee1 v2v: Split out source and source_disks.
Remove the source.s_disks field and keep it as a separate list.

This is just refactoring.  For more about the purpose of this change:
https://www.redhat.com/archives/libguestfs/2019-October/msg00072.html
2019-10-11 16:29:57 +01:00
Richard W.M. Jones
e3a3c2fd6c v2v: Remove 4 unused parameters to output#prepare_targets.
Not used by any existing output mode, remove the parameters.
2019-10-11 16:12:41 +01:00
Richard W.M. Jones
50a4a41ef3 v2v: Don't pass full metadata to output#prepare_targets.
The existing output objects only used the s_name field so pass that
instead.  (There was one minor exception: -o libvirt adjusted an error
message based on the hypervisor field but that was simply to fix.)
2019-10-11 16:03:33 +01:00
Richard W.M. Jones
624fff6461 v2v: Pass source.s_disks to conversion fn instead of whole metadata.
Existing conversions do not use anything except the source disks, so
only pass this.

This also renames src_disks -> source_disks in a few places for
consistency.

Pure refactoring with no change in function, designed to reduce
coupling between stages.
2019-10-11 15:57:47 +01:00
Richard W.M. Jones
ee400894f9 virt-tools: Remove -Ifish from various tools.
Appears to be a copy and paste error.  At least, I cannot understand
why any of these tools would borrow source code from guestfish.
2019-10-11 15:33:51 +01:00
Tomáš Golembiovský
00b4ed312b v2v: windows: install QEMU Guest Agent MSI
Use firstboot script to install MSI with QEMU-GA from virtio-win ISO or
oVirt/RHV guest tools ISO.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2019-10-10 17:14:51 +01:00
Richard W.M. Jones
2299154dc8 Version 1.41.5. 2019-10-09 19:15:07 +01:00
Richard W.M. Jones
dfd9fac743 v2v: Copy static IP address information over for Windows guests (RHBZ#1626503).
For Linux the guest itself remembers the IP address associated with
each MAC address.  Thus it doesn't matter if the interface type
changes (ie. to virtio-net), because as long as we preserve the MAC
address the guest will use the same IP address or the same DHCP
configuration.

However on Windows this association is not maintained by MAC address.
In fact the MAC address isn't saved anywhere in the guest registry.
(It seems instead this is likely done through PCI device type and
address which we don't record at the moment and is almost impossible
to preserve.)  When a guest which doesn't use DHCP is migrated, the
guest sees the brand new virtio-net devices and doesn't know what to
do with them, and meanwhile the right static IPs are still associated
with the old and now-defunct interfaces in the registry.

We cannot collect the required information from within the guest.
However we can collect it outside the tool by some other means
(eg. using VMware Tools APIs) and present this information to virt-v2v
which then writes it into the Windows guest at firstboot time.

This commit adds the --mac ..:ip:.. sub-option which creates a
Powershell script to set network adapters at firstboot.  An option
such as:

  --mac 00:0c:29:e6:3d:9d:ip:192.168.0.89,192.168.0.1,24,192.168.0.254

approximately turns into this script:

  # Wait for the netkvm (virtio-net) driver to become active.
  $adapters = @()
  While (-Not $adapters) {
      Start-Sleep -Seconds 5
      $adapters = Get-NetAdapter -Physical |
                     Where DriverFileName -eq "netkvm.sys"
  }
  $mac_address = '00-0c-29-e6-3d-9d'
  $ifindex = (Get-NetAdapter -Physical |
                 Where MacAddress -eq $mac_address).ifIndex
  if ($ifindex) {
      New-NetIPAddress -InterfaceIndex $ifindex
                       -IPAddress '192.168.0.89'
                       -DefaultGateway '192.168.0.1'
                       -PrefixLength 24
      Set-DnsClientServerAddress -InterfaceIndex $ifindex
                       -ServerAddresses ('192.168.0.254')
  }

Thanks: Brett Thurber for diagnosing the problem and suggesting paths
towards a fix.
2019-10-08 13:32:34 +01:00
Richard W.M. Jones
e1e9b3845e v2v: windows: Add a helper function for installing Powershell firstboot scripts. 2019-10-08 13:30:05 +01:00
Richard W.M. Jones
d4840bd29f Update website/download/builder/index.
Fixes commit a3320aaa50.
2019-10-08 13:29:23 +01:00
Richard W.M. Jones
12f5e2eb90 v2v: nbdkit: Add the retry filter unconditionally if it exists.
This experimental filter can be used to work around brief
interruptions in service, such as the network going down, firewalls
timing out connections etc., without requiring virt-v2v to be rerun.
2019-10-08 13:15:10 +01:00
Richard W.M. Jones
4ad6e184a9 v2v: Implement SSH password authentication for Xen and VMX over SSH.
For example:
$ virt-v2v -i vmx -it ssh -ip /tmp/passwd \
    'ssh://root@esxi/vmfs/volumes/datastore1/Windows/Windows.vmx' -o null
2019-10-08 13:15:10 +01:00
Richard W.M. Jones
735529b393 v2v: Implement the --bandwidth* options to control network bandwidth.
For input methods which use nbdkit, we can cheaply add
nbdkit-rate-filter to control input-side network bandwidth.  These
options control that filter.  We can choose to set the bandwidth
statically and optionally change it dynamically:

  --bandwidth 10M
    # static bandwidth of 10 Mbps, no dynamic adjustment possible

  --bandwidth 5M --bandwidth-file /tmp/bw
    # initial static bandwidth of 5 Mbps, adjustable by writing to /tmp/bw

  --bandwidth-file /tmp/bw
    # no initial bandwidth cap, can be added later by writing to /tmp/bw

It only makes sense to control the input side since virt-v2v writes a
lot less data than it reads.
2019-10-08 13:15:10 +01:00
Richard W.M. Jones
0aa3545e4d v2v: vCenter: Replace qemu block curl driver with nbdkit-curl-plugin.
Because of the self-configuring readahead plugin we can entirely get
rid of input#adjust_overlay_parameters, which is definitely a good
thing.
2019-10-08 13:15:10 +01:00
Richard W.M. Jones
bded1ee837 v2v: -i libvirtxml: Replace qemu block curl driver with nbdkit-curl-plugin.
‘virt-v2v -i libvirtxml’ has a little-known feature where it can read
network disks over HTTP or HTTPS.  This can be used to test VMware
conversions without needing VMware, although as far as I can tell the
current test suite does not use the feature.  This commit changes this
functionality to use nbdkit-curl-plugin instead of the qemu curl
driver.

This change shouldn't affect functionality.  The readahead size is
changed from a fixed 1M buffer to using the readahead filter which is
self-configuring.

See also commit 38bf2a0f97 which
originally introduced this functionality in 2017.
2019-10-08 13:15:10 +01:00
Richard W.M. Jones
d481598067 v2v: nbdkit: Add the readahead filter unconditionally if it is available.
The readahead filter is a self-configuring filter that makes
sequential reads faster when the plugin is slow (and all of the
plugins we use here are always slow).

I observed the behaviour of the readahead filter with our qcow2
overlay when converting a guest from a vCenter source.  Even when
doing random reads, qemu issues 64K reads which happen to also be the
minimum request size of the readahead filter, so there is no extra
overhead.  When doing the sequential copy the readahead filter
performed better than qemu curl’s readahead because it scaled the
prefetched data appropriately on long contiguous stretches and then
shrunk it back to 64K around fragmented parts of the base image.
2019-10-08 13:15:10 +01:00
Richard W.M. Jones
0796092e05 v2v: nbdkit: Add a generic function to probe if filters are available.
This uses the technique described in the nbdkit-probing(1) man page.
It should work with a wide range of versions of nbdkit, and is the one
which the nbdkit developers currently recommend.
2019-10-08 13:15:10 +01:00
Richard W.M. Jones
56727f8431 v2v: nbdkit: Add support for nbdkit-curl-plugin. 2019-10-08 13:15:10 +01:00
Richard W.M. Jones
57f6c72a9d v2v: -i vmx -it ssh: Replace qemu block ssh driver with nbdkit-ssh-plugin.
One immediately advantage is we can use libvirt again.
2019-10-08 13:15:10 +01:00
Richard W.M. Jones
0977f4b909 v2v: xen: Replace qemu block ssh driver with nbdkit-ssh-plugin.
Initially this is a like-for-like replacement, but in future commits
this will allow us to implement:

 - password authentication (instead of SSH agent)

 - bandwidth throttling

 - readahead

Note this requires nbdkit >= 1.12.
2019-10-08 13:15:10 +01:00
Richard W.M. Jones
8e5930b9a8 v2v: nbdkit: Add support for nbdkit-ssh-plugin. 2019-10-08 13:15:10 +01:00
Richard W.M. Jones
ca9f904b22 v2v: Generic code for querying nbdkit version and plugin.
In forthcoming commits we will be adding support for ssh, curl and
other features that require nbdkit >= 1.12.

As a prelude to that work, add generic code for querying ‘nbdkit
--dump-config’ and ‘nbdkit plugin --dump-plugin’ and checking the
minimum version number.

This changes the minimum version from 1.1.16 to 1.2, although that was
released about a year ago and is widely available, and in any case
we're going to require 1.12 in the next commit.
2019-10-08 13:15:10 +01:00
Richard W.M. Jones
0899f876a1 v2v: Factor out the nbdkit VDDK code into a new module.
This refactoring takes the nbdkit-specific code from the ‘-it vddk’
mode and puts it into a separate module.  The idea is to reuse this
module (in future commits) to support ssh, curl and rate limiting.

This refactoring is not quite neutral because it moves some of the
prechecking into the Nbdkit.create function.  This means it will
happen a little bit later in the cycle (in input#source instead of
input#precheck - refer to the diagram in v2v/types.mli).  However it's
still almost in the same place and importantly still happens before we
start copying.
2019-10-08 13:15:10 +01:00
Tomáš Golembiovský
644a6e4637 build: define CGO_CFLAGS_ALLOW with -U option we need
cgo does not allow arbitrary CFLAGS to be used. Instead it contains a
list of flags (safelist) that are allowed to be passed to the compiler.
Sadly -U option (introduced in commit d8d8c856a1) is not among them.

See: https://github.com/golang/go/issues/23672

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2019-10-07 22:08:49 +01:00
Richard W.M. Jones
a3320aaa50 builder: templates: Add CentOS 8.0 2019-10-04 09:01:32 +01:00
Richard W.M. Jones
f7733f44c3 builder: templates: Work around for CentOS 8.0 kickstart brokenness. 2019-10-04 09:01:05 +01:00
Richard W.M. Jones
0177552375 daemon: btrfs: Fix parsing for new output from btrfs scrub.
The format changed at some point breaking our existing parsing code.
Typical example of the new format is below.

UUID:             b8604449-c7b5-4d3b-9fad-56114e8594f5
Scrub started:    Wed Oct  2 12:54:06 2019
Status:           finished
Duration:         0:00:00
\tdata_extents_scrubbed: 0
\ttree_extents_scrubbed: 16
\tdata_bytes_scrubbed: 0
\ttree_bytes_scrubbed: 262144
\tread_errors: 0
\tcsum_errors: 0
\tverify_errors: 0
\tno_csum: 0
\tcsum_discards: 0
\tsuper_errors: 0
\tmalloc_errors: 0
\tuncorrectable_errors: 0
\tunverified_errors: 0
\tcorrected_errors: 0
\tlast_physical: 253493248
2019-10-02 14:29:35 +01:00
Richard W.M. Jones
9f516b4fcc builder: templates: Increase RAM for installation to 4G on all architectures.
We thought this could solve the CentOS problem, but it did not.
However it's probably a useful change anyway.
2019-10-02 10:23:31 +01:00
Richard W.M. Jones
b8372310cc builder: templates: Add support for centos-8.0.
Unfortunately I could not get the install to work yet:
https://lists.centos.org/pipermail/centos-devel/2019-September/017813.html
2019-10-02 10:23:31 +01:00
Pino Toscano
0a5eaad7db v2v: -o rhv-upload: make -oo rhv-cafile optional
It makes little sense to require the oVirt certificate, especially when
the verification of the connection (-oo rhv-verifypeer) is disabled by
default.  The only work done with the certificate in that case is
checking that it is a valid certificate file.

Hence, make -oo rhv-cafile optional, requiring it only when
-oo rhv-verifypeer is enabled.
2019-09-27 13:56:42 +02:00
Pino Toscano
02890096d5 builder: templates: set "unassigned" hostname
By default the installer will set the hostname to what the DHCP returns,
exposing details of the machine where make-template.ml runs.

Instead, force "unassigned-hostname.unassigned-domain" as hostname, so
plays nicely with the hostname setting code in virt-customize.
2019-09-26 13:32:50 +02:00
Richard W.M. Jones
aee0f3b011 website: Update index file. 2019-09-20 10:34:45 +01:00
Richard W.M. Jones
7050f4a6a6 erlang: Avoid deprecation warnings.
According to the Erlang website:

  The old legacy erl_interface library (functions with prefix erl_) is
  deprecated as of OTP 22, and will be removed in OTP 23. This does
  not apply to the ei library. Reasonably new gcc compilers will issue
  deprecation warnings. In order to disable these warnings, define the
  macro EI_NO_DEPR_WARN.

That's a shame and probably means we will have to drop the Erlang
bindings soon unless someone ports them to this new API (stable APIs
FTW people!).  In the meantime add the flag to prevent warn-errors
about deprecation.
2019-09-20 10:34:45 +01:00
Pino Toscano
29dc045bc6 v2v: -o rhv-upload: use same tmpdir for Python scripts
Make use of the temporary directory of the rhv-upload mode also for the
Python scripts that the mode creates, instead of creating new
directories.
2019-09-20 11:14:07 +02:00
Pino Toscano
b659d044f7 v2v: add optional tmpdir parameter for Python_script
Add an optional parameter for Python_script.create, to specific the
temporary directory to use instead of creating a new one.
2019-09-20 11:11:38 +02:00
Pino Toscano
977fac2012 v2v: linux: do not install qemu-guest-agent if already installed
In case qemu-guest-agent is already installed in the guest, then do not
attempt to install it again.

Reported by Martin Kletzander.
2019-09-20 11:11:38 +02:00
Pino Toscano
1311842a64 v2v: linux: install linux tools after unconfigurations
Install the new tools after removing the old hypervisor tools.

It should not change the result of the conversion.
2019-09-20 11:11:38 +02:00
Pino Toscano
537ba8357e v2v: -o rhv-upload: add -oo rhv-disk-uuid option
This way it is possible to override the UUIDs of the uploaded disks,
instead of letting RHV generate them.

This can be useful to force certain UUIDs, and to specify the disks in
--no-copy mode (which now can be used).
2019-09-20 11:11:38 +02:00
Pino Toscano
0a9d7efb40 v2v: -o rhv-upload: check for a valid image transfer right away
Check for the INITIALIZING state of the image transfer right away,
without waiting 5 seconds even before the first time: this way, if the
transfer is already in the right state then there is no need to wait.
2019-09-20 11:11:38 +02:00
Pino Toscano
0f3686e9ed v2v: -o rhv-upload: cancel disk transfer on open failure
Make sure to cancel the trasfer in RHV in case of failure during the
open/creation of the disk in RHV, so it is automatically removed.
2019-09-20 11:11:38 +02:00
Martin Kletzander
da71714a9a build: Move po subdir after everything else except po-docs
Otherwise it complains about missing files that it has no rules for, for example
`builder/index-parser.c`.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2019-09-20 10:01:16 +01:00
Pino Toscano
27690f55ff v2v: -o rhv-upload: adapt phony ovirtsdk4 module to recent changes
Add the missing objects, methods, variables, and relations among the
various objects.

Followup/fixes commit c49aa4fe01, and
commit 8118f28b6f.
2019-09-19 12:27:23 +02:00
Richard W.M. Jones
bbf4aeaf2b builder: templates: Add centos-7.7. 2019-09-18 10:52:12 +01:00
Richard W.M. Jones
cece35e114 builder: templates: Add rhel-7.7 kickstart and virt-install command. 2019-09-18 10:52:12 +01:00
Pino Toscano
8118f28b6f v2v: -o rhv-upload: cancel disk transfer on failure
Make sure to cancel the trasfer in RHV in case of failure during the
copying of a disk: this way, the disk can be actually removed by RHV
itself.
2019-09-17 15:04:36 +02:00
Pino Toscano
145ae3db04 v2v: -o rhv-upload: remove uploaded disks on failure
In case the whole conversion fails, run a new Python script to cleanup
all the uploaded (and finalized) disks.
2019-09-17 15:04:36 +02:00
Pino Toscano
7b93ad6a32 v2v: -o rhv-upload: collect disks UUIDs right after copy
Instead of waiting for the completion of the nbdkit transfers to get the
UUIDs of the disks, use the new #disk_copied hook to do that after each
disk is copied.

This has almost no behaviour on rhv-upload, except for the --no-copy
mode:
- previously it used to hit the 5 minute timeout while waiting for the
  finalization of the first disk
- now it asserts on the different number of collected UUIDs vs the
  actual targets; at the moment there is nothing else that can be done,
  as this assumption is needed e.g. when creating the OVF file
2019-09-17 15:04:36 +02:00
Pino Toscano
74ee936505 v2v: add output#disk_copied hook
Add a simple method in the Output class to do work right after a disk
was successfully copied.
2019-09-17 15:04:36 +02:00
Pino Toscano
2b39c27b7f v2v: -o rhv-upload: tell whether a SD actually exists
If there is no DC with the specified storage domain attached to it, it
can mean that the SD does not exist.
2019-09-17 15:04:36 +02:00
Pino Toscano
c49aa4fe01 v2v: -o rhv-upload: improve lookup of specified resources (RHBZ#1612653)
Improve the way the precheck script checks for the specified resources:
- look directly for a data center with the specified storage domain
- get the storage domain object from the storage domains attached to the
  data center found
- similarly, look for the specified cluster among the ones attached to
  the data center found
When everything is found, return the UUID of the storage domain, and of
the cluster back to virt-v2v, which will store them.

Similarly, rework the createvm script to directly get the requested
cluster, instead of looking for it once again.  Also, since the UUID of
the storage domain is available in virt-v2v already, use it directly
instead of using a placeholder.

This should fix a number of issues:
- unexisting/unattached storage domains are rejected outright
- the cluster is rejected if not part of the same data center of the
  selected storage domain
- renaming the specified storage domain during the data copying will not
  cause the conversion to fail (which will still use the specified
  storage domain, no matter the new name)

Based on the hints by Daniel Erez in RHBZ#1612653.
2019-09-17 15:04:21 +02:00
Pino Toscano
cc6e2a7f9e v2v: -o rhv-upload: change precheck script to return a JSON
This way it is possible to communicate data from the precheck script
back to virt-v2v.

For now there are no results, so the resulting JSON is discarded.
2019-09-17 14:04:47 +02:00
Pino Toscano
6499fdc199 v2v: -o rhv-upload: split vmcheck out of precheck
Split the VM existance check out of the precheck script to a new vmcheck
script, and invoke that in #prepare_targets.  Invoke the precheck script
in #precheck, as now it can be run with only values of command line
options.

This does not change which checks are performed; however, an invalid
cluster name will make virt-v2v fail way earlier (even before connecting
to the source).
2019-09-17 14:03:13 +02:00
Pino Toscano
dea9636c59 Remove remaining virt-p2v bits
Remove (almost) all the remaining bits related to virt-p2v.
2019-09-10 17:52:16 +02:00
Pino Toscano
2c02adb8ba Remove virt-p2v
This removes only the tool itself, and all the bits strictly needed to
not break the build.

This is now available as separate tool in its own repository:
https://github.com/libguestfs/virt-p2v
2019-09-10 17:52:16 +02:00
Eric Blake
730642676b drives: Typo fix
Favor 'atomically' over 'atomicly'.

Signed-off-by: Eric Blake <eblake@redhat.com>
2019-09-10 16:40:17 +01:00
Daniel Erez
eeabb3fdc7 v2v: rhv-upload-plugin - improve wait logic after finalize (RHBZ#1680361)
After invoking transfer_service.finalize, check operation status by
examining DiskStatus.  This is done instead of failing after a
predefined timeout regardless the status.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1680361
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Tested-by: Ilanit Stein <istein@redhat.com>
2019-09-09 17:04:18 +01:00
Chris Lamb
d58c4e79d8 Make the build reproducible
Whilst working on the Reproducible Builds effort [0] we noticed
that libnbd could not be built reproducibly.

This is due to it shipping a pod generation wrapper that
does not use/respect SOURCE_DATE_EPOCH [1] and additionally
varies the output depending on the build user's current
timezone.

(This was originally filed in Debian as #939546 [2].)

 [0] https://reproducible-builds.org/
 [1] https://reproducible-builds.org/docs/source-date-epoch/
 [2] https://bugs.debian.org/939546

Signed-off-by: Chris Lamb <lamby@debian.org>
2019-09-06 09:42:35 +01:00
Richard W.M. Jones
a0f9553d21 html: Link within all libguestfs projects. 2019-09-05 15:11:40 +01:00
Richard W.M. Jones
74ce7332db ocaml: Change calls to caml_named_value() to cope with const value* return.
In OCaml >= 4.09 the return value pointer of caml_named_value is
declared const.

Based on Pino Toscano's original patch to ocaml-augeas.
2019-09-05 09:00:14 +01:00
Nir Soffer
fcfdbc9420 v2v: Set DISKTYPE=2 in RHV and VDSM meta files (RHBZ#1746699).
Added in virt-p2v commit:

  commit e83b6f50af34ce650063ecc520bfabab400e8e73
  Author: Matthew Booth <mbooth@redhat.com>
  Date:   Fri Mar 26 09:40:20 2010 +0000

    Add export to RHEV

    Allow guests to be written to a RHEV NFS export storage domain.

    Add 'rhev' output method and -osd command-line option.
    Example command line:

     virt-v2v -f virt-v2v.conf -ic 'esx://yellow.rhev.marston/' \
              -o rhev -osd blue:/export/export RHEL3-32

    This will connect to an ESX server and write the guest 'RHEL3-32' to
    blue:/export/export, which is a pre-initialised RHEV export storage domain.
2019-09-02 21:20:27 +01:00
Richard W.M. Jones
bf5ee2fb21 Version 1.41.4. 2019-09-02 19:45:12 +01:00
Richard W.M. Jones
bbe4490795 rust: Don't add Cargo.lock to EXTRA_DIST.
It's a file generated by cargo.  If cargo is not installed then this
breaks ‘make dist’.
2019-09-02 19:28:30 +01:00
Richard W.M. Jones
ad58324c70 Version 1.41.3. 2019-09-02 12:56:12 +01:00
Richard W.M. Jones
cce016dfe3 docs: Remove p2v/ directory from generated docs files.
make[2]: *** No rule to make target '../p2v/about-authors.c', needed by 'internal-documentation.pod'.  Stop.

Since we're going to remove the whole p2v subdirectory shortly anyway,
it was simplest to ignore the whole directory.
2019-09-02 12:34:07 +01:00
Richard W.M. Jones
e8ab5b451a Version 1.41.2. 2019-09-02 12:23:28 +01:00
Richard W.M. Jones
0d0c3eb1dd docs: Remove generated file common/mllibvirt/libvirt_c.c.
Avoids this error when building from git:

make[2]: *** No rule to make target '../common/mllibvirt/libvirt_c.c', needed by 'internal-documentation.pod'.  Stop.

This file doesn't have any generated docs or gettext annotations in it
so adding it to these files is useless anyway.
2019-09-02 12:22:25 +01:00
Richard W.M. Jones
2a5ea2892e Version 1.41.1. 2019-09-02 10:12:38 +01:00
Richard W.M. Jones
3f8609434f rust: Add more source files to EXTRA_DIST.
Fixes commit 3f7ff1b068.
2019-09-02 10:01:05 +01:00
Richard W.M. Jones
ffd0b5484d Revert "rust: Add missing file to EXTRA_DIST."
This reverts commit 9a6d162852.

(This file was later removed in
commit 3f7ff1b0689408695d21b4c50384fa24b47e5e8f.)
2019-09-02 10:01:05 +01:00
Richard W.M. Jones
15d1611889 python: Ignore -Wcast-align warnings in Python 3.8 header files.
Disable this warning/error in the Python 3.8 header files:

In file included from /usr/include/python3.8/abstract.h:837,
                 from /usr/include/python3.8/Python.h:147,
                 from actions.h:31,
                 from actions-6.c:34:
/usr/include/python3.8/cpython/abstract.h: In function '_PyVectorcall_Function':
/usr/include/python3.8/cpython/abstract.h:91:11: error: cast increases required alignment of target type [-Werror=cast-align]
   91 |     ptr = (vectorcallfunc*)(((char *)callable) + offset);
      |           ^
2019-09-02 09:00:18 +01:00
Richard W.M. Jones
451e6a7b97 python: Include <Python.h> in one place.
Previously to work around some problems in Python 2 header files we
had to include <Python.h> before any other config file.

For Python 3 which is all we really care about now this is no longer
needed.  We can move the include from three files into the local
"actions.h" file, bringing all the Python definitions and workarounds
into a single place.
2019-09-02 09:00:18 +01:00
Pino Toscano
2581d3c25e build: disable deprecated GTK stuff
We are not using deprecated GTK APIs/stuff, so make sure to not
accidentally use them, and easily catch more deprecations in the future.
2019-09-02 09:00:18 +01:00
Pino Toscano
ff7d94faf8 Copy GtkAttachOptions from GTK >= 3.4
GtkAttachOptions is part of GtkTable, which is used only with GTK < 3.4;
however, these enum values are used also in the GtkGrid version of the
code, so they are needed also when disabling deprecated stuff.

As easy solution to make the current code working without deprecated
stuff of GTK, copy the GtkAttachOptions enum when using GtkGrid (i.e.
with GTK >= 3.4).
2019-09-02 09:00:18 +01:00
Richard W.M. Jones
0731767a20 ocaml: Compile compat bytes.mli file. 2019-08-20 18:10:41 +01:00
Richard W.M. Jones
031016444a m4: ocaml: Remove unused definitions of OCAML_BYTES_COMPAT_*
These were last used in commit 024efc0f2f
and commit 8d09d716aa (both in Jul 2017).
2019-08-20 18:08:43 +01:00
Richard W.M. Jones
4b9efadce2 v2v: Fix missing backslash character in list of tests.
Fixes commit c0d95dcde8.
2019-08-20 17:43:10 +01:00
Richard W.M. Jones
2fbf9a3f94 Update gnulib.
Contains fix for a bug where it would always compile the
replacement accept4 function.

https://lists.gnu.org/archive/html/bug-gnulib/2019-08/msg00029.html

Thanks: Eric Blake
2019-08-20 17:32:19 +01:00
Richard W.M. Jones
11923627cd builder: templates: Add Debian 10 (buster). 2019-08-20 16:59:56 +01:00
Richard W.M. Jones
2cd905f093 Update gnulib. 2019-08-20 16:11:49 +01:00
Richard W.M. Jones
c873e04b26 Update docs/C_SOURCE_FILES. 2019-08-20 16:11:49 +01:00
Pino Toscano
5d94be2583 generator: improve pod2text invocation
- feed the content directly to stdin, avoid the need of read (and write)
  a temporary file
- read all the output at once, without a tail-recursive function
- apply trimming and first line discarding after closing the process
2019-08-13 16:01:25 +02:00
Pino Toscano
81a01f20c3 generator: adjust variable names
Rename some pod2text-related variables to better-fitting names.

This is just a small refactoring.
2019-08-13 13:45:13 +02:00
Pino Toscano
da0137e828 generator: isolate memoized cache in own module
Isolate the logic for the memoized disk cache in a small module, so it
can be reused for other tools.

Other than refactoring, there should be no behaviour changes.
2019-08-13 13:19:17 +02:00
Pino Toscano
8402a73465 v2v: -o rhv-upload: fix the phony ovirtsdk4 module
- add a no-op Connection.close(), as it called explicitly in the
  close() callback of the nbdkit plugin (rhv-upload-plugin.py)
- fix the types of the 'id' variables, which are strings
2019-08-13 07:43:42 +02:00
Pino Toscano
0c261637f9 Fix small issues in documentations of APIs
- fix names of arguments & optional arguments in C<..> markers
- use https for URLs where possible
- fix links to other guestfs APIs
- use more C<..> markers for special tests, shell commands, values of
  arguments, and names of fields
- link to command man pages where an explicit command is mentioned
- fix few incorrect documentation bits
2019-08-13 07:43:42 +02:00
Richard W.M. Jones
52c7e787d2 rust: Add README.md to EXTRA_DIST.
Fixes previous commit.
2019-08-12 20:36:28 +01:00
Hiroyuki Katsura
212f1a5f71 Rust bindings: Make it able to publish this crate
I added
- data required to publish this crate to `crates.io`.
- README.md which contains the details of how to publish this crate.
2019-08-12 20:34:47 +01:00
Richard W.M. Jones
dcfa382b27 v2v: Remove double space.
Tiny whitespace-only fix.
2019-08-09 12:51:10 +01:00
Richard W.M. Jones
4f30db5ae4 Update gnulib to latest version.
This fixes some test breakage I was experiencing with recent
kernel/glibc.
2019-08-08 13:17:37 +01:00
Richard W.M. Jones
7692c31494 v2v: -i vmx: Use scp -T option if available to unbreak scp (RHBZ#1733168).
Tested using:

cd v2v
LIBGUESTFS_BACKEND=direct ../run virt-v2v -i vmx -it ssh "ssh://localhost/$PWD/test-v2v-i-vmx-1.vmx" -o null -v -x

and manually examining the debug output.

Thanks: Ming Xie, Jakub Jelen.
2019-08-08 12:08:17 +01:00
Hiroyuki Katsura
3f7ff1b068 Rust bindings: Implement callback handlers
This patch includes:

- Event callback handlers
- Tests related to events(410-430)

src/bin/event.rs and src/bin/event_leak.rs
are the PoCs that Boxes related to callbacks are
not leaked.
2019-08-06 14:54:04 +01:00
Hiroyuki Katsura
bb0cb3e730 Rust bindings: Add Event structs, Clarify Handle lifetime
Without clarifying handle's lifetime, it is unable
to see how long the callbacks which the handle
owns will live. Then, Rust compiler will infer
that the callbacks have 'static lifetime. It is
not convenient for users.
2019-08-06 14:54:04 +01:00
Richard W.M. Jones
ab09bc25c7 build: Update miscellaneous files.
BUGS
docs/C_SOURCE_FILES
po/POTFILES
po/POTFILES-ml

These files are normally updated by ‘make dist’ but as we've not had a
release in a while they had not been updated for some time.
2019-07-29 12:57:24 +01:00
Richard W.M. Jones
b81c252e44 p2v: Add .gitignore to EXTRA_DIST.
Fixes commit 9fe175cd76.
2019-07-29 12:55:22 +01:00
Richard W.M. Jones
34a0a724c0 v2v: Fix EXTRA_DIST.
Fixes commit a27748d700.
2019-07-29 12:54:11 +01:00
Richard W.M. Jones
97e2be01b5 common/mltools: Fix EXTRA_DIST.
Fixes commit f79129b8dc.
2019-07-29 12:53:14 +01:00
Richard W.M. Jones
9a6d162852 rust: Add missing file to EXTRA_DIST. 2019-07-29 12:22:20 +01:00
Richard W.M. Jones
94f20e2511 rust: Remove rust/.gitignore from EXTRA_DIST.
Fixes commit b484ca4da1.
2019-07-29 12:18:17 +01:00
Richard W.M. Jones
45e66a567d generator: Use ~copyrights shorthand for ~copyrights:copyrights 2019-07-29 12:15:32 +01:00
Richard W.M. Jones
e6f5ec35cc generator: copywrites -> copyrights 2019-07-29 12:14:23 +01:00
Richard W.M. Jones
b484ca4da1 rust: Move .gitignore to top level file and add extra files. 2019-07-29 12:12:14 +01:00
Hiroyuki_Katsura
3bbd00c83e Rust bindings: Add Rust bindings
This patch includes Actions and their tests. Missing:

- Events
- Examples

Rust bindings: Add create / close functions

Rust bindings: Add 4 bindings tests

Rust bindings: Add generator of structs

Rust bindings: Add generator of structs for optional arguments

Rust bindings: Add generator of function signatures

Rust bindings: Complete actions

Rust bindings: Fix memory management

Rust bindings: Add bindtests

Rust bindings: Add additional 4 bindings tests

Rust bindings: Format test files

Rust bindings: Incorporate bindings to build system
2019-07-29 10:28:31 +01:00
Pino Toscano
6d251e3828 v2v: remove extra nbdkit bit from documentation (RHBZ#1723305)
Since there is no more need to build nbdkit from sources, then there is
no need to set $PATH with a custom build of nbdkit.

Followup of commit 0704d8eb0b.
2019-07-18 15:38:53 +02:00
Pino Toscano
730d2122c4 p2v: split appliance tests in own variable
This way they can be properly shipped also when creating a distribution
tarball ('make dist') from a build configured with --disable-appliance.
2019-07-08 18:58:19 +02:00
Pino Toscano
99cec3c1e7 p2v: fix tests with srcdir!=builddir
Point to files in the source directory using the right variables, so
they are found also when the build directory is different than the
source directory.
2019-07-08 18:56:06 +02:00
Pino Toscano
c5db961cf1 p2v: consider p2v-config.h as generated source
While it is generated at configure time for dependency reasons, consider
it a generated source nevertheless: after the first run, there will be
dependency rules available, so automake will trigger the proper rule to
generate it again using generate-p2v-config.pl.
2019-07-08 17:58:23 +02:00
Pino Toscano
31e8ae38d9 p2v: clean also the test images
Followup of commit ea4d9bd157, and
commit f02c0cb552.
2019-07-08 17:57:41 +02:00
Richard W.M. Jones
c22a8b68fe v2v: Allow Windows virtio ISO to be a block device as well as a regular file.
Thanks: Steven Rosenberg
2019-07-04 22:23:52 +01:00
Pino Toscano
f30840e01b p2v: stop including guestfs.h
It is no more needed, guestfs-utils.h is enough these days.
2019-07-03 12:41:02 +02:00
Pino Toscano
498f940419 contrib: move p2v files within p2v 2019-07-03 12:41:02 +02:00
Pino Toscano
fe96e24001 p2v: generate C about data authors from AUTHORS file
Create a small Perl script to generate about-authors.c from the p2v
AUTHORS file at build time, instead of generating in the generator
at dist time.
2019-07-03 12:41:02 +02:00
Pino Toscano
e7a550c2d8 p2v: ship generate-p2v-config.pl
Fixes commit 796ce74f31.
2019-07-03 12:41:02 +02:00
Pino Toscano
1fe60aabdf p2v: remove non-author credits
Soon only the virt-p2v authors will be available, so remove all the
other roles.  This leaves only in the virt-p2v about dialog, which is a
mild regression compared to the current situation, although it is just
for user information.
2019-07-03 12:40:52 +02:00
Pino Toscano
7ad6afc222 p2v: generate an AUTHORS file
Create a simple AUTHORS file for virt-p2v, so it is easier to
extract or use it later on.
2019-07-02 15:40:39 +02:00
Pino Toscano
f02c0cb552 p2v: tests: use a local blank-part disk image
Instead of using the "global" blank-part test image, use a local version
of it created with guestfish.
2019-07-01 18:47:18 +02:00
Pino Toscano
ea4d9bd157 p2v: tests: switch windows image with local fedora one
Instead of using the "global" Windows test image, use a local Fedora
image created with virt-builder.
2019-07-01 18:44:30 +02:00
Pino Toscano
9fe175cd76 p2v: split gitignore
Move (or copy the general ones) all the p2v entries in the top-level
.gitignore file to a new file specific for p2v.  This will make it
easier to keep them when splitting p2v.
2019-07-01 18:38:09 +02:00
Pino Toscano
35916b6030 generator: remove p2v_config
No more used now, as this configuration is generated within p2v itself
at build time.
2019-07-01 14:26:44 +02:00
Pino Toscano
180290ff74 p2v: move kernel config POD docs to perl script
Copy from generator/p2v_config.ml also the bits for POD documentation,
adding them to generate-p2v-config.pl; this way,
virt-p2v-kernel-config.pod can be generated at build time directly,
instead of statically shipped as generator output.
2019-07-01 14:14:56 +02:00
Pino Toscano
796ce74f31 p2v: move kernel config to perl script
Instead of generating the p2v kernel config using the OCaml generator,
create a Perl script to do this job, mostly at build time.  This is done
to rely less on the generator for p2v, and because the generation of
these sources is quick enough that it can be done at build time (instead
of shipping the generated sources in dist tarballs).

The generate-p2v-config.pl mimics what generator/p2v_config.ml --
namings, and general structure are kept close to that for comparison.

The two C sources are created at build time by the script; however, the
p2v-config.h header is generated at configure time: this is done because
p2v-config.h is included by p2v.h (another header), which in turn is
included by all the p2v C sources -- automake is not able to properly
resolve the dependency, and thus it would not be generated properly.
2019-07-01 13:58:13 +02:00
Richard W.M. Jones
c4638739d6 python: PYTHON_LIBS is not set in Python 3.8 (RHBZ#1705482).
Python 3.8 no longer links C extensions to -lpython, instead relying
on the fact that the python binary itself already contains those
symbols.  This means $PYTHON_LIBS is empty and so the Python bindings
are not built.

Use a different test to see if the python module is available.
2019-05-31 13:07:25 +01:00
Pino Toscano
ca8f8afcc5 Revert "daemon: implement OptString for OCaml APIs"
This causes the build to fail, as Val_optstring is still not used by any
generated C glue function.

This reverts commit 8e51e9078f.
2019-05-30 09:45:40 +02:00
Pino Toscano
8e51e9078f daemon: implement OptString for OCaml APIs
It is already considered as string option, so create an option string
value in the C glue for OptString parameters.
2019-05-30 09:12:32 +02:00
Pino Toscano
8eb696f827 appliance: remove custom Shadow augeas lens
Now that augeas 1.2.0 is required, assume the Shadow lens is available
there, and thus drop the local copy.
2019-05-30 09:12:32 +02:00
Pino Toscano
31d72dc463 build: raise augeas requirement to 1.2.0
It is widely available also on older distributions.
2019-05-30 09:12:32 +02:00
Richard W.M. Jones
2bb6be333e appliance: Remove /etc/dhcp/dhclient-enter-hooks.d/resolved.
Workaround for Ubuntu which uses this script to try to start a systemd
service.  That won't work because systemd is not used inside the
appliance.  See:

https://bugs.launchpad.net/ubuntu/+source/supermin/+bug/1824236

Thanks: Ioanna Alifieraki
2019-05-29 17:54:52 +01:00
Pino Toscano
0cafcc0e88 build: build C sources using OCaml API with CAML_NAME_SPACE
This way no non-namespaced OCaml C symbols are used, reducing the risk
of clashes with other code.

The only exception is ocaml-augeas, which does not build with
CAML_NAME_SPACE; it will be fixed upstream, and it affects only
ocaml-augeas itself.
2019-05-28 11:39:20 +02:00
Martin Kletzander
c2918b8b74 Use proper label for nbdkit sockets
While svirt_t can be used for sockets it does not always guarantee that it will
be accessible from a virtual machine.  The VM might be running under svirt_tcg_t
context which will need a svirt_tcg_t label on the socket in order to access it.

There is, however, another label, svirt_socket_t, which is accessible from
virt_domain:

  # sesearch -A -s svirt_t -c unix_stream_socket -p connectto
  ...
  allow virt_domain svirt_socket_t:unix_stream_socket { ... connectto ... };
  ...

And virt_domain is a type attribute of both svirt_t and svirt_tcg_t:

  # seinfo -x -a virt_domain
  Type Attributes: 1
     attribute virt_domain;
          svirt_t
          svirt_tcg_t

Resolves: https://bugzilla.redhat.com/1698437

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2019-05-28 10:14:37 +01:00
Pino Toscano
2ad84a080d tests: import importlib.util directly
It seems that on older Python 3 versions importlib.util is not imported
automatically when importlib is imported; as solution, import
importlib.util directly (as it is what is used, anyway).

Fixes commit f79129b8dc.
2019-05-24 14:49:05 +02:00
Pino Toscano
c9543de73d launch: libvirt: fix custom hypervisor check
Previously, is_custom_hv() used to compare the QEMU executable found
during configure to the hypervisor set to check whether it is a custom
one; however, the QEMU found at configure time can be different than
what libvirt was configured with.

This fixes the libvirt backend when libguestfs is configured with a
different QEMU, that now will be specified as emulator overriding the
libvirt one.
2019-05-24 14:49:05 +02:00
Pino Toscano
797925cc3c launch: libvirt: get default QEMU from domcapabilities
Parse the libvirt domain capabilities for the default emulator
capabilities, and get the path to the default QEMU executable.
2019-05-24 14:49:05 +02:00
Pino Toscano
8d453fe9cc build: stop looking for ocaml-libvirt
We ship our own copy of it, so we do not need the external version.
(Also, the latest upstream version of ocaml-libvirt was already not
usable to build the test harness of v2v.)
2019-05-20 13:40:19 +02:00
Pino Toscano
5c4bd181b6 v2v: test-harness: stop using the external ocaml-libvirt
Use the embedded copy.
2019-05-20 13:40:19 +02:00
Pino Toscano
3e89a1d44f v2v: -o libvirt: switch away from virsh
Now that we have a proper libvirt connection object, use it directly to
refresh the storage pool, and define the final guest.  This avoids
spawning a new virsh process twice, with no possibility to even share a
possible authentication required.
2019-05-20 13:40:19 +02:00
Pino Toscano
e8f9ea2f67 v2v: -o libvirt: use a Lazy for the connection
Store the Libvirt.Connect.t object as instance variable, so it can be
used also outside of prepare_targets.  Use a private method to access
it, so there is no need to directly use the Lazy object.
2019-05-20 13:40:19 +02:00
Pino Toscano
a871f6c251 v2v: switch to ocaml-libvirt
Currently virt-v2v has few custom C-based functions for libvirt
operations, which are limited in what they do, and there is a lot of
duplicated code.

Instead, switch to ocaml-libvirt for all the libvirt interaction
currently done by the Libvirt_utils module.  This has few advantages:
- each input & output module now opens a libvirt connection only once,
  only when needed
- no need to pass URIs and passwords around, if not needed
- a wider range of libvirt APIs can now be used, with no need to create
  bindings manually

The hierarchy of input_libvirt* classes is changed to take a Lazy object
with the libvirt connection, accessing it through a "proctected" method:
this way, the connection is opened only at the first access.
Also, the Libvirt_utils module now is just helpers around the Libvirt
module, to centralize error handling, and few common operations.
2019-05-20 13:40:19 +02:00
Pino Toscano
99493eeddd common: Bundle the libvirt-ocaml library for use by virt-v2v
Add a copy of the libvirt-ocaml library, currently available at:
  https://libvirt.org/git/?p=libvirt-ocaml.git;a=summary
This is a snapshot at commit d3ed8dcf1b0a6a8a855ceecbe0bb97f21e6665e3,
which has all the features we need (and that builds fine).
It is expected to stay synchronized with upstream, until there is a new
upstream release, and it will be widespread enough.
2019-05-20 13:32:59 +02:00
Pino Toscano
c0d95dcde8 v2v: require libvirt
While there are input modes that do not use libvirt, making libvirt
mandatory for virt-v2v slightly simplifies the code now, and allow for
further improvements/integration with libvirt later on.
2019-05-20 13:30:23 +02:00
Pino Toscano
71b021c99d v2v: -o json: add a simple test for it
Followup of commit f190e08d85.
2019-05-20 10:22:29 +02:00
Richard W.M. Jones
052d2be483 builder: templates: Add RHEL 8.0 (x86-64 only for now). 2019-05-10 16:24:53 +01:00
Richard W.M. Jones
652e8de397 builder: templates: Remove RHEL 8 Alpha temporary hacks. 2019-05-10 16:24:53 +01:00
Richard W.M. Jones
05decc6976 builder: Fedora 30 templates. 2019-05-04 21:07:05 +01:00
Pino Toscano
8bbf8e8900 test-data: switch away from deprecated APIs
Adapt make-fedora-img.pl to not use deprecated APIs anymore:
- set_e2uuid -> set_uuid
- txz_in -> tar_in + compress:xz

This causes no changes in the generated test images.
2019-05-02 18:34:18 +02:00
Pino Toscano
9f39e9be24 python: silence usage of add_cdrom in test
One test explicitly tests add_cdrom, so silence the deprecation warning
only for that function.
2019-04-24 12:49:48 +02:00
Pino Toscano
19ce506ccb perl: silence usage of add_cdrom in test
One test explicitly tests add_cdrom, so silence the deprecation warning
only for that function.
2019-04-24 12:49:28 +02:00
Pino Toscano
b6a7157751 python: modernize inspect_vm example
Since we already assume Python >= 2.7, modernize this example to make it
work also on Python 3:
- use print() as function
- sort the mount points using a key for sorted(), instead of a
  comparison function
- remove extra newline escape
- reident two lines according to the PEP 8 style
2019-04-24 11:59:36 +02:00
Pino Toscano
96aed2fc9e perl: show warnings for deprecated functions
Emit a deprecation warning when a deprecated function is used, so users
have a way to know that they are using one.
2019-04-23 18:08:19 +02:00
Pino Toscano
a7666c1f1c ruby: show warnings for deprecated functions
Emit a warning when a deprecated function is used, so users have a way
to know that they are using one.
2019-04-23 18:08:19 +02:00
Pino Toscano
cf865444a8 python: show warnings for deprecated functions
Emit a DeprecationWarning warning when a deprecated function is used, so
users have a way to know that they are using one.
2019-04-23 18:08:19 +02:00
Pino Toscano
d8d8c856a1 lib: introduce GUESTFS_NO_DEPRECATED
Add a simple way to do not even provide prototypes of deprecated
functions in the C library: this way, users (like our tools) can build
against the library making sure to not use any deprecated function, not
even when compiler deprecation warnings are disabled.

Add it to the majority of our tools/internal libraries, and make sure
that it is not defined when building the API bridges of our bindings.
2019-04-23 18:08:19 +02:00
Pino Toscano
9d1fc91cca build: stop using GUESTFS_WARN_DEPRECATED
This is no more used now, as compiler deprecation warnings are triggered
by default.
2019-04-23 18:08:19 +02:00
Pino Toscano
84d0f5aa9f lib: enable deprecation warnings by default
Right now, deprecated functions of the library do not trigger any
compiler deprecation warning by default; they do that only if
GUESTFS_WARN_DEPRECATED=1 is defined.  However, this is not something
that seems to be done often -- at least none of the projects using the
libguestfs C API does that.

Hence, do a small behaviour change to change this on the other way
round: now deprecated functions trigger compiler deprecation warnings by
default, using GUESTFS_NO_WARN_DEPRECATED to disable this (and revert
to the previous behaviour).  Even though deprecated functions will not
be removed, we really want users to migrate away from them, as they were
deprecated for good reasons.

Define GUESTFS_NO_WARN_DEPRECATED where needed:
- in all the bindings, as they bind all the functions including the
  deprecated ones
- in the guestfish actions, as it exposes almost all the APIs
- in the C API test, as it runs the automated tests of all the APIs that
  have them
- for two tests that explicitly test deprecated functions
2019-04-23 18:08:19 +02:00
Pino Toscano
7a54596aaf tests: switch last-errno away from deprecated APIs
This test only calls stat to check the failure on missing file, so
switch to statns to get the same behaviour with a non-deprecated API.
2019-04-23 18:06:31 +02:00
Pino Toscano
05e559549d v2v: -o rhv-upload: check whether the cluster exists
In the precheck script, check that the target cluster actually exists.
This will avoid errors when creating the VM after the data copying.
2019-04-16 12:17:18 +02:00
Denis Plotnikov
4cfc071a84 daemon: drop error message check in do_part_expand_gpt
part-expand-gpt takes extreme cautions and doesn't proceed to writing
to the disk if the preliminary dry run of sgdisk has generated any
warnings on stdout.

This blocks the use of part-expand-gpt on disk shrink (with disk
resize being the main usecase for part-expand-gpt), because sgdisk dry
run produces a warning in that case.

So remove the excessive safety check, and leave it up to the caller.

Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
Reviewed-by: Roman Kagan <rkagan@virtuozzo.com>
2019-04-16 09:32:02 +01:00
Richard W.M. Jones
3b2d83d470 v2v: Move have_selinux to utils.
This is not quite a neutral refactoring, because it means we now run
the getenforce command every time virt-v2v starts up.  However it's a
trivial command that reads a single /sys file and it can't fail even
if the command is missing or on platforms that know nothing about
SELinux.
2019-04-15 11:41:29 +01:00
Richard W.M. Jones
5067968297 common/mlstdutils: Add String.unix2dos function.
Simple string line ending replacement convenience function.
2019-04-15 11:41:29 +01:00
Pino Toscano
1629ec6a56 v2v: warn when the guest has direct network interfaces (RHBZ#1518539)
virt-v2v obviously cannot convert this kind of devices, since they are
specific to the host of the hypervisor.  Thus, emit a warning about the
presence of direct network interfaces, so at least this can be noticed
when converting a guest.
2019-04-12 17:28:12 +02:00
Pino Toscano
0704d8eb0b v2v: update documentation on nbdkit (RHBZ#1605242)
nbdkit >= 1.6 ships a VDDK plugin always built, so recommend that
version instead of recommending to build nbdkit from sources.
2019-04-12 16:19:43 +02:00
Pino Toscano
fb7983f999 v2v: start reading the new libvirt firmware autoselect
Starting with 5.2.0, libvirt has a way to select automatically the
firmware for a guest using an attribute of the <os> tag.  Hence, use
this information (when available, of course) to flag the firmware used
by the guest.
2019-04-08 18:23:27 +02:00
Pino Toscano
3720900438 inspect: get icon of OpenMandriva guests
Followup of commit a4ef6716b4.
2019-04-08 13:34:11 +02:00
Pino Toscano
c4205809bc inspect: correct osinfo ID for ALT Linux >= 8
ALT Linux 8.x has different IDs in osinfo-db, so return the proper IDs
for the newest stable series.
2019-04-04 10:25:03 +02:00
Pino Toscano
764ee8c74e inspect: return osinfo short IDs for rolling distros
Return the right osinfo short IDs for some rolling Linux distributions,
such as Arch Linux, Gentoo, and Void Linux.  Their IDs were recently
added to osinfo-db.
2019-04-04 10:25:03 +02:00
Pino Toscano
aee4a96ce2 inspect: fully detect Arch Linux from os-release
Consider Arch Linux as rolling distribution, so it is recognized using
/etc/os-release.

The end result does not change, although this makes Arch Linux inspected
using os-release only, instead of getting inspection details mixed from
both os-release and lsb-release.
2019-04-04 10:25:03 +02:00
Pino Toscano
c0155f5823 inspect: detect Gentoo from os-release
Add "gentoo" as recognized ID in /etc/os-release, and consider it as
rolling distribution (so without VERSION_ID in os-release).

This avoids using a not-useful version read from /etc/gentoo-release,
e.g. "Gentoo Base System release 2.6".
2019-04-04 10:25:03 +02:00
Pino Toscano
a6db759a72 inspect: factorize list of rolling distros
Use a static list of rolling distros, so it is easier to handle them
differently; use this list for handling the lack of VERSION_ID in
os-release files.

This is just refactoring, no behaviour changes.
2019-04-04 10:25:03 +02:00
Hiroyuki Katsura
7772cfc771 Add missing python bindings tests
Signed-off-by: Hiroyuki Katsura <hiroyuki.katsura.0513@gmail.com>
2019-04-03 17:28:58 +01:00
Bernhard Rosenkränzer
a4ef6716b4 Add OpenMandriva support as guest and host (RHBZ#1694268). 2019-04-03 13:08:08 +01:00
Pino Toscano
f190e08d85 v2v: add -o json output mode
Add a new output mode to virt-v2v: similar to -o local, the written
metadata is a JSON file with the majority of the data that virt-v2v
knowns about (or collects) during the conversion.

This is meant to be used only when no existing output mode is usable,
and a guest needs to be converted to run on KVM anyway.  The user of
this mode is supposed to use all the data in the JSON, as they contain
important details on how even run the guest (e.g. w.r.t. firmware,
drivers of disks/NICs, etc).
2019-04-01 18:44:00 +02:00
Pino Toscano
a27748d700 v2v: add Var_expander
This helper module provides a facility to replace %{FOO}-like variables
in text strings with user-provided content.
2019-04-01 18:44:00 +02:00
Pino Toscano
0ed2e5c14a common/mlpcre: add offset flag for PCRE.matches
This way it is possible to change where the matching start, instead of
always assuming it is the beginning.
2019-04-01 18:44:00 +02:00
Pino Toscano
1086599ad8 OCaml tools: fix 3999 -> 3339 typo
RFC 3339 is the actual RFC for date/time strings.
Typo found by Martin 'eagle eyes' Kletzander.

Fixes commit f79129b8dc.
2019-04-01 18:44:00 +02:00
Richard W.M. Jones
e047cc4da8 lib: qemu: rbd: Properly escape IPv6 addresses.
Each ':' character in the address must be escaped from qemu.

Thanks: Jonathan Wright
2019-04-01 17:31:25 +01:00
Pino Toscano
f79129b8dc OCaml tools: output messages into JSON for machine readable
When the machine readable mode is enabled, print all the messages
(progress, info, warning, and errors) also as JSON in the machine
readable stream: this way, users can easily parse the status of the
OCaml tool, and report that back.

The formatting of the current date time into the RFC 3999 format is done
in C, because of the lack of OCaml APIs for this.
2019-03-29 13:57:47 +01:00
Pino Toscano
70514dfaf1 common/mltools: allow fd for machine readable output
Allow to specify a file descriptor for the machine readable output.

Use the same assumption as done in v2v, i.e. that Unix.file_descr is
simply the int file descriptor.
2019-03-29 13:57:47 +01:00
Pino Toscano
abf1607f46 common/mltools: make sure machine readable output is flushed
Enhance the helper printf function for machine readable output to always
flush after each string: this way, readers of the machine readable
stream can get the output as soon as it is outputted.
2019-03-29 13:57:46 +01:00
Pino Toscano
8b06ea0ebc common/mltools: move the code for machine readable up
Move the code for handling machine readable up in the file, so it can be
used by other functions.

Only code motion, no behaviour changes.
2019-03-29 13:57:46 +01:00
Tomáš Golembiovský
200bec7cfd v2v: windows: save log file from rhev-apt installer
Store log from MSI installer. Log file will be located in firstboot
scripts-done directory with name rhev-apt.log. The path has to be
double-quoted to handle spaces in path name properly.

Hopefully this can help resolve RHBZ#1584678 someday.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2019-03-27 16:34:44 +01:00
Tomáš Golembiovský
f4bda5571a v2v: fix path to source when copying files from guest tools directory
The debug message was slightly changed too to better match the similar
message for ISO case. It refers to the root directory instead of the
specific subdirectory inside guest tools.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
2019-03-27 16:34:44 +01:00
Pino Toscano
cbf887ed90 v2v: change the reporting of RHV Tools messages/warnings/error
The RHV Tools ISO is provided as Red Hat only product, and thus not
available for all the virt-v2v users.  Hence, change the way we report
the status of the installation of the qemu guest agent from the RHV
Tools ISO:
- do not warn if virt-v2v does not know how to install the package for
  the current guest
- do not warn if the ISO does not contain packages for the current guest
- on successful installations, show an info message

Related: RHBZ#1691659
2019-03-27 14:46:34 +01:00
Pino Toscano
78f08a15fa v2v: try to pick the right arch for qemu-ga pkgs
Right now the code copies, and then tries to install, all the files
found for the directory of a distro.  This does not take into account
differences in the architectures of the packages available, so a x86_64
package must be installed only on x86_64 guests.

As solution, filter the packages using the typical suffix used by
packages (so architecture + file extension), to pick only packages
compatible with the current guest.
2019-03-27 14:46:34 +01:00
Pino Toscano
13ef175a7b v2v: linux: add helper functions for pkg arch and extension
Add helper functions to get the typical extension of binary packages
for a package manager, and the string for an architecture.
2019-03-27 14:46:34 +01:00
Richard W.M. Jones
ba7fa03923 lib: direct: Set QEMU_AUDIO_DRV=none when testing schema.
Schema parsing was failing with errors such as:

libguestfs: QMP parse error: '[' or '{' expected near end of file (ignored)

This happened because the QMP command was actually completely failing
and never printing a result at all.  This happens because the qemu
audio driver can't be set up without a console.  We can suppress this
by setting the environment variable QEMU_AUDIO_DRV=none, which is the
same thing that libvirt does, and also the same thing that we are
already doing when launching the real appliance subprocess.

See also: https://bugzilla.redhat.com/show_bug.cgi?id=1692047
2019-03-27 11:53:31 +00:00
Pino Toscano
c0a78ea844 v2v: test-v2v-conversion-of.sh: basic check for libvirt XML
Use virt-xml-validate to check that the libvirt XML is actually valid,
at least regarding its schema.
2019-03-26 15:40:05 +01:00
Pino Toscano
831f3c06b9 v2v: test-v2v-conversion-of.sh: update the guest
Make sure the create guest is always up-to-date: this way it is possible
to test the conversion even taking into account the latest upgrades
available.
2019-03-26 15:40:05 +01:00
Pino Toscano
4e108ae225 v2v: tests: add debian-9 and fedora-29 for test-v2v-conversion-of
Test the newer versions of these distros.
2019-03-26 15:40:05 +01:00
Richard W.M. Jones
464de98ff6 inspector: Fix tests to match new Windows 7 osinfo information.
Fixes commit 3ed32996dd.
2019-03-26 10:18:58 +00:00
Pino Toscano
1a4fd822ef v2v: linux: do not uninstall open-vm-tools w/ ubuntu-server
ubuntu-server depends on open-vm-tools on Ubuntu, so if v2v tries to
uninstall open-vm-tools then dpkg will (rightfully) fail with a
dependency issue.

Since open-vm-tools is harmless after the conversion anyway (it will
not even run), then do not attempt to uninstall it if ubuntu-server is
installed too.

Followup of commit 2bebacf8bf.

Thanks to: Ming Xie.
2019-03-25 16:10:21 +01:00
Pino Toscano
3ed32996dd inspect: return osinfo short IDs for recent Windows versions
Return the right osinfo short IDs for the majority of Windows versions
since Windows XP.
2019-03-25 16:10:20 +01:00
Pino Toscano
bb11507fff v2v: -o libvirt: write win2k19 osinfo ID
When writing the libosinfo metadata in the libvirt XML, use the newly
added (in osinfo-db) ID for Windows Server 2019; sadly, this version of
Windows has the same version as Windows Server 2016, so distinguish it
by looking at its product name.
2019-03-25 16:10:20 +01:00
Pino Toscano
c648052690 inspect: fix icon of RHEL
Use a better icon for RHEL guests, still provided by redhat-logos (or
equivalent in downstream distributions), and which fits a better
definition of logo for the distribution.

Thanks to Ray Strode for the hints.
2019-03-25 16:10:20 +01:00
Mike Latimer
612f170e60 v2v: Fix default graphics driver for SUSE guests.
See discussion in this upstream thread:
https://www.redhat.com/archives/libguestfs/2019-February/thread.html#00047

Thanks: Mike Latimer, Pino Toscano.
2019-03-25 14:41:00 +00:00
Pino Toscano
363b5e0b4e v2v: linux: improve arch detection from modules (RHBZ#1690574)
Try to look for a well known kernel module (so far only virtio, or kvm)
to use for detecting the architecture of a kernel.  This way, we can
avoid picking 3rd party modules that cause troubles.
2019-03-20 17:41:07 +01:00
Pino Toscano
0a093035d4 v2v: linux: canonicalize module path for arch detection (RHBZ#1690574)
Kernel modules can be also symlinks to files available outside the
"canonical" module directory; the "file" API, used by the
"file-architecture" API, return the actual type of a file (so symlinks,
block devices, etc), and thus "file-architecture" fails on symlinks.

To prevent this situation, canonicalize the path of the module picked
for architecture detection: this way, "file-architecture" will act on a
real file.
2019-03-20 17:41:07 +01:00
Pino Toscano
89b5dabf8d tests: skip test-relabel.pl when selinuxrelabel is not available
test-relabel.pl performs a full SELinux relabelling of the phony guest,
and the selinux_relabel API does not work if the "selinuxrelabel"
feature is not available.
2019-02-11 16:43:53 +01:00
Pino Toscano
c8a26adf1d inspect: get icon of Gentoo guests
The icon is installed by x11-themes/gentoo-artwork, which is not
installed by default (and most probably only on "desktop"
installations), although it's the best hit so far...
2019-02-07 19:00:13 +01:00
Pino Toscano
f41a75cea6 inspect: revamp icon extraction for *SUSE guests
Newer versions do not have the 24px distributor.png icon; OTOH they have
the 48px version, so look for that one before the 24px one.

Also, bump the size limit to 10K, as newer versions of the icon are
bigger than 3K.
2019-02-06 15:19:53 +01:00
Pino Toscano
6ff95acc72 inspect: factor out find_png helper function
Isolate the code for looking for a PNG file among a specified list from
the icon_ubuntu implementation, and switch that function to it.

This is just code refactoring, with no behaviour changes.
2019-02-06 15:15:08 +01:00
Pino Toscano
032b8d4c72 inspect: bump size limit for Mageia guests
Newer versions of the logo in Cauldron are almost 3K, so bump the limit
to 10K for now.
2019-02-06 15:05:51 +01:00
Pino Toscano
5eafd12731 v2v: linux: use NEVR for querying RPM packages (RHBZ#1669395)
Use NEVR when querying RPM for the list of files of a package, instead
of ENVR.  Also, use the epoch only when non-zero, and version of RPM
supports it.

The approach is basically copied from what supermin does in its RPM
package handler.
2019-01-30 16:59:32 +01:00
Richard W.M. Jones
b26bd778b5 build: Reduce -Wformat-overflow=2 to =1.
GCC 9 gives this error:

qemuopts.c: In function 'qemuopts_to_config_channel':
qemuopts.c:987:29: error: '%.*s' directive output between 0 and 2147483647 bytes may exceed minimum required size of 4095 [-Werror=format-overflow=]
  987 |             fprintf (fp, "  %.*s = ", (int) k, values[j]);
      |                             ^~~~
qemuopts.c:987:26: note: assuming directive output of 1 byte
  987 |             fprintf (fp, "  %.*s = ", (int) k, values[j]);
      |                          ^~~~~~~~~~~

See discussion at the following GCC bug:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88993
2019-01-24 09:54:23 +00:00
Pino Toscano
fbaa5f003a build: correctly report whether vala is enabled
Use the right autoconf variable.

Followup of commit 4f96e823d3.
2019-01-23 14:56:27 +01:00
Corentin Noël
4f96e823d3 gobject: Add Vala binding support
RWMJ: Add optional dependency on vala to the docs.
2019-01-23 13:05:59 +00:00
Pino Toscano
0ee02e0117 python: change types for RBufferOut/FBuffer with Python 3 (RHBZ#1661871)
So far RBufferOut return values, and FBuffer struct fields are 'str' on
all the versions of Python.  Python 3 distinguishes between 'str'
(unicode strings), and 'bytes', with 'str' no more able to hold
arbitrary data.

For this reason, switch the return value of RBufferOut functions, and
FBuffer struct fields to bytes on Python 3: while this is a potentially
incompatibile change, this is the only way to handle safely sequences
of arbitrary bytes.
2019-01-22 14:29:13 +01:00
Pino Toscano
85235aec83 python: fix call of Python handlers of events
Make sure to reference the arguments, to make sure they are kept alive
during the function call; this is visible when setting an event handler
for the CLOSE event, and testing it with Python 3.

This does not seem to create a memory leak e.g. with Python 2.

Also, switch away from the quasi-internal PyEval_CallObject to the
public PyObject_CallObject, which takes care of doing safety checks.
2019-01-22 12:43:11 +01:00
Pino Toscano
a8006afaf5 build: integrate ocaml-link.sh with automake silent rules
In case either the silent rules are disabled, or V=1 is set, print the
full command line that is executed.
2019-01-22 12:31:03 +01:00
Richard W.M. Jones
ea7c13fed7 valgrind: Add workaround for slow loading of debuginfo by valgrind.
See nbdkit commit
bd32d899ed
and https://bugzilla.redhat.com/show_bug.cgi?id=1662656
2019-01-17 12:03:07 +00:00
2332 changed files with 1961639 additions and 848202 deletions

161
.github/workflows/main.yml vendored Normal file
View File

@@ -0,0 +1,161 @@
# Run the jobs below on every push to master branch and pull request.
on:
push:
branches:
- master
pull_request:
branches:
- master
# Runs basic configure, make and make check.
jobs:
ubuntu:
name: Ubuntu
runs-on: ubuntu-${{ matrix.release }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
release:
- 24.04
steps:
- name: Identify the system
run: |
cat /etc/os-release
- name: Enable source repositories
run: |
sudo sed -i 's/Types: deb$/Types: deb deb-src/g' \
/etc/apt/sources.list.d/ubuntu.sources
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get -y build-dep libguestfs
- name: Install extra dependencies
run: |
# Git is needed to run git submodule command.
# json-c is missing from the Ubuntu package deps.
sudo apt-get -y install git libjson-c-dev
- name: Fix broken Ubuntu kernel permissions
run: |
# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/759725
sudo chmod 0644 /boot/vmlinuz*
- name: Enable KVM
run: |
sudo chmod 0666 /dev/kvm
- name: Checkout sources
uses: actions/checkout@v5
- name: Checkout submodule
run: |
git submodule update --init
- name: Compile the code
run: |
autoreconf -fiv
./configure --disable-gobject --enable-werror
make -j
- name: Run the quick test
run: |
make quickcheck
- name: Run the full tests
run: |
# grub-install: error: /usr/lib/grub/i386-pc/modinfo.sh
# doesn't exist. Please specify --target or --directory
export SKIP_TEST_GRUB_INSTALL_0=1
# Errors from hexdump, maybe not installed?
export SKIP_TEST_HEXDUMP_0=1
export SKIP_TEST_HEXDUMP_1=1
export SKIP_TEST_HEXDUMP_2=1
# error: luks_close: cryptsetup exited with status 5:
# Device lukstest is still in use
export SKIP_TEST_LUKS_SH=1
# error: passt exited with status 1
export SKIP_TEST_NETWORK_SH=1
# error: passt exited with status 1
export SKIP_TEST_RSYNC_SH=1
if ! make check; then
find -name test-suite.log -exec cat {} \;
exit 1
fi
fedora:
name: Fedora
runs-on: ubuntu-latest # VM where the container runs
strategy:
fail-fast: false
matrix:
release:
- 42
- 43
container:
image: quay.io/fedora/fedora:${{ matrix.release }}
options: --security-opt seccomp=unconfined
steps:
- name: Identify the system
run: |
cat /etc/os-release
- name: Install build dependencies
run: |
dnf builddep -y libguestfs
- name: Install extra dependencies
run: |
# Git is needed to run git submodule command.
# The others are needed to run the tests.
dnf install -y git kernel sqlite perl-hivex rubygem-minitest
- name: Checkout sources
uses: actions/checkout@v5
- name: Create user
run: |
useradd -m -s /bin/bash -G wheel guestfs
tail /etc/passwd
- name: Make checkout directory editable by the sscg user
run: |
chown -R guestfs:wheel ${GITHUB_WORKSPACE}
- name: Checkout submodule
run: |
su -c 'git submodule update --init' guestfs
- name: Compile the code
run: |
su -c '
autoreconf -fiv &&
./configure CFLAGS="-fPIC -g -O2" --disable-gobject --enable-werror &&
make -j
' guestfs
- name: Run the quick test
run: |
su -c 'make quickcheck' guestfs
- name: Run the full tests
run: |
# error: passt exited with status 1
export SKIP_TEST_NETWORK_SH=1
# error: passt exited with status 1
export SKIP_TEST_RSYNC_SH=1
# error: internal_autosync: umount: /sysroot: umount: /sysroot:
# target is busy
export SKIP_RHBZ1011907_1165785_SH=1
# We have to set $HOME since su -p won't set it below.
export HOME=/home/guestfs
if ! su -p -c 'make check' guestfs; then
find -name test-suite.log -exec cat {} \;
exit 1
fi

294
.gitignore vendored
View File

@@ -35,9 +35,7 @@ Makefile.in
/.sc-*
/aclocal.m4
/align/stamp-virt-alignment-scan.pod
/align/virt-alignment-scan
/align/virt-alignment-scan.1
/appliance/guestfsd.deps
/appliance/libguestfs-make-fixed-appliance
/appliance/libguestfs-make-fixed-appliance.1
/appliance/make.sh
@@ -47,33 +45,10 @@ Makefile.in
/appliance/supermin.d
/AUTHORS
/autom4te.cache
/bash/guestunmount
/bash/libguestfs-test-tool
/bash/virt-builder
/bash/virt-cat
/bash/virt-copy-in
/bash/virt-copy-out
/bash/virt-customize
/bash/virt-df
/bash/virt-dib
/bash/virt-diff
/bash/virt-edit
/bash/virt-filesystems
/bash/virt-format
/bash/virt-get-kernel
/bash/virt-inspector
/bash/virt-log
/bash/virt-ls
/bash/virt-p2v-make-disk
/bash/virt-p2v-make-kickstart
/bash/virt-p2v-make-kiwi
/bash/virt-resize
/bash/virt-sysprep
/bash/virt-sparsify
/bash/virt-tail
/bash/virt-tar-in
/bash/virt-tar-out
/bash/virt-win-reg
/build-aux/.gitignore
/build-aux/ar-lib
/build-aux/compile
@@ -86,110 +61,24 @@ Makefile.in
/build-aux/snippet/
/build-aux/test-driver
/build-aux/ylwrap
/builder/.depend
/builder/*.img
/builder/index-parse.c
/builder/index-parse.h
/builder/index_parser_tests
/builder/index-scan.c
/builder/libguestfs.conf
/builder/opensuse.conf
/builder/osinfo_config.ml
/builder/oUnit-*
/builder/*.out
/builder/*.qcow2
/builder/repository-testdata
/builder/stamp-virt-builder.pod
/builder/stamp-virt-builder-repository.pod
/builder/stamp-virt-index-validate.pod
/builder/test-config/virt-builder/repos.d/test-index.conf
/builder/test-console-*.sh
/builder/test-simplestreams/virt-builder/repos.d/cirros.conf
/builder/test-website/virt-builder/repos.d/libguestfs.conf
/builder/virt-builder
/builder/virt-builder-repository
/builder/virt-builder.1
/builder/virt-builder-repository.1
/builder/virt-index-validate
/builder/virt-index-validate.1
/builder/*.xz
/cat/stamp-virt-*.pod
/cat/virt-cat
/cat/virt-cat.1
/cat/virt-filesystems
/cat/virt-filesystems.1
/cat/virt-log
/cat/virt-log.1
/cat/virt-ls
/cat/virt-ls.1
/cat/virt-tail
/cat/virt-tail.1
/ChangeLog
/common/errnostring/errnostring.c
/common/errnostring/errnostring-gperf.c
/common/errnostring/errnostring-gperf.gperf
/common/errnostring/errnostring.h
/common/miniexpect/miniexpect.3
/common/mlaugeas/.depend
/common/mlgettext/.depend
/common/mlgettext/common_gettext.ml
/common/mlpcre/.depend
/common/mlpcre/pcre_tests
/common/mlprogress/.depend
/common/mlstdutils/.depend
/common/mlstdutils/bytes.ml
/common/mlstdutils/bytes.mli
/common/mlstdutils/guestfs_config.ml
/common/mlstdutils/oUnit-*
/common/mlstdutils/std_utils_tests
/common/mltools/.depend
/common/mltools/getopt_tests
/common/mltools/JSON_tests
/common/mltools/JSON_parser_tests
/common/mltools/machine_readable_tests
/common/mltools/tools_utils_tests
/common/mltools/oUnit-*
/common/mlutils/.depend
/common/mlutils/c_utils_unit_tests
/common/mlutils/oUnit-*
/common/mlvisit/.depend
/common/mlvisit/visit_tests
/common/mlxml/.depend
/common/protocol/guestfs_protocol.c
/common/protocol/guestfs_protocol.h
/common/protocol/guestfs_protocol.x
/common/qemuopts/qemuopts-tests
/common/structs/structs-cleanups.c
/common/structs/structs-cleanups.h
/common/structs/structs-print.c
/common/structs/structs-print.h
/compile
/config.cache
/config.guess
/config.h
/config.h.in
/config.log
/config.sh
/config.status
/config.sub
/configure
/csharp/Libguestfs.cs
/customize/.depend
/customize/customize_cmdline.ml
/customize/customize_cmdline.mli
/customize/customize-options.pod
/customize/customize-synopsis.pod
/customize/stamp-virt-customize.pod
/customize/test-firstboot-*.sh
/customize/test-password-*.sh
/customize/test-settings-*.sh
/customize/virt-customize
/customize/virt-customize.1
/daemon/.depend
/daemon/actions.h
/daemon/blkid.mli
/daemon/btrfs.mli
/daemon/callbacks.ml
/daemon/caml-stubs.c
/daemon/cryptsetup.mli
/daemon/daemon_config.ml
/daemon/daemon_utils_tests
/daemon/devsparts.mli
@@ -202,11 +91,13 @@ Makefile.in
/daemon/guestfsd.exe
/daemon/inspect.mli
/daemon/is.mli
/daemon/isoinfo.mli
/daemon/ldm.mli
/daemon/link.mli
/daemon/listfs.mli
/daemon/lvm.mli
/daemon/lvm-tokenization.c
/daemon/lvm_dm.mli
/daemon/lvm_full.mli
/daemon/md.mli
/daemon/mount.mli
/daemon/names.c
@@ -216,6 +107,9 @@ Makefile.in
/daemon/optgroups.mli
/daemon/parted.mli
/daemon/realpath.mli
/daemon/rpm.mli
/daemon/selinux.mli
/daemon/sfdisk.mli
/daemon/stamp-guestfsd.pod
/daemon/statvfs.mli
/daemon/structs-cleanups.c
@@ -225,24 +119,15 @@ Makefile.in
/daemon/stubs-?.c
/daemon/stubs.h
/daemon/types.ml
/daemon/xfs.mli
/depcomp
/df/stamp-virt-df.pod
/df/virt-df
/df/virt-df.1
/dib/.depend
/dib/output_format_*.mli
/dib/stamp-virt-dib.pod
/dib/virt-dib
/dib/virt-dib.1
/diff/stamp-virt-diff.pod
/diff/virt-diff
/diff/virt-diff.1
/docs/guestfs-building.1
/docs/guestfs-faq.1
/docs/guestfs-hacking.1
/docs/guestfs-internals.1
/docs/guestfs-performance.1
/docs/guestfs-recipes.1
/docs/guestfs-release-notes-1.*.1
/docs/guestfs-release-notes.1
/docs/guestfs-security.1
/docs/guestfs-testing.1
@@ -253,12 +138,10 @@ Makefile.in
/docs/stamp-guestfs-internals.pod
/docs/stamp-guestfs-performance.pod
/docs/stamp-guestfs-recipes.pod
/docs/stamp-guestfs-release-notes-1.*.pod
/docs/stamp-guestfs-release-notes.pod
/docs/stamp-guestfs-security.pod
/docs/stamp-guestfs-testing.pod
/edit/stamp-virt-*.pod
/edit/virt-edit
/edit/virt-edit.1
/erlang/actions-?.c
/erlang/actions.h
/erlang/bindtests.erl
@@ -310,9 +193,6 @@ Makefile.in
/fish/virt-copy-out.1
/fish/virt-tar-in.1
/fish/virt-tar-out.1
/format/stamp-virt-format.pod
/format/virt-format
/format/virt-format.1
/fuse/guestmount
/fuse/guestmount.1
/fuse/guestunmount
@@ -327,36 +207,24 @@ Makefile.in
/generator/generator
/generator/.pod2text.data*
/generator/stamp-generator
/get-kernel/.depend
/get-kernel/stamp-virt-get-kernel.pod
/get-kernel/virt-get-kernel
/get-kernel/virt-get-kernel.1
/.gitattributes
/.git-module-status
/gnulib
/GNUmakefile
/gobject/bindtests.js
/gobject/Guestfs-1.0.gir
/gobject/Guestfs-1.0.typelib
/gobject/guestfs-gobject.3
/gobject/libguestfs-gobject-1.0.vapi
/gobject/stamp-guestfs-gobject.pod
/golang/bindtests.go
/golang/bindtests/bindtests.go
/golang/examples/guestfs-golang.3
/golang/examples/stamp-guestfs-golang.pod
/golang/pkg
/haskell/Bindtests
/haskell/Bindtests.hs
/haskell/Guestfs010Load
/haskell/Guestfs030Config
/haskell/Guestfs050LVCreate
/haskell/Guestfs.hs
/inspector/actual-*.xml
/inspector/stamp-virt-inspector.pod
/inspector/test-virt-inspector.sh
/inspector/test-virt-inspector-luks.sh
/inspector/test-xmllint.sh
/inspector/virt-inspector
/inspector/virt-inspector.1
/include/guestfs.h
/installcheck.sh
/install-sh
/java/actions-?.c
@@ -374,7 +242,6 @@ Makefile.in
/lib/guestfs.3
/lib/guestfs-actions.pod
/lib/guestfs-availability.pod
/lib/guestfs.h
/lib/guestfs-internal-actions.h
/lib/guestfs-structs.pod
/lib/libguestfs.3
@@ -382,6 +249,7 @@ Makefile.in
/lib/libguestfs.syms
/lib/.libs/libguestfs.so
/lib/libvirt-is-version
/lib/local/libguestfs.pc
/lib/stamp-guestfs.pod
/lib/structs-compare.c
/lib/structs-copy.c
@@ -399,7 +267,6 @@ Makefile.in
/lua/guestfs.so
/lua/lua-guestfs.c
/m4/ChangeLog
/m4/gnulib-cache.m4
/m4/intmax.m4
/m4/libtool.m4
/m4/lt~obsolete.m4
@@ -407,9 +274,6 @@ Makefile.in
/m4/ltsugar.m4
/m4/ltversion.m4
/maint.mk
/make-fs/stamp-virt-make-fs.pod
/make-fs/virt-make-fs
/make-fs/virt-make-fs.1
/missing
/ocaml-dep.sh
/ocaml-link.sh
@@ -423,6 +287,7 @@ Makefile.in
/ocaml/examples/guestfs-ocaml.3
/ocaml/examples/inspect_vm
/ocaml/examples/stamp-guestfs-ocaml.pod
/ocaml/guestfs
/ocaml/guestfs-c-actions.c
/ocaml/guestfs-c-errnos.c
/ocaml/guestfs.ml
@@ -432,43 +297,6 @@ Makefile.in
/ocaml/stamp-mlguestfs
/ocaml/t/*.bc
/ocaml/t/*.opt
/p2v/about-authors.c
/p2v/config.c
/p2v/dependencies.archlinux
/p2v/dependencies.debian
/p2v/dependencies.redhat
/p2v/dependencies.suse
/p2v/kernel-config.c
/p2v/p2v-config.h
/p2v/stamp-test-virt-p2v-pxe-data-files
/p2v/stamp-test-virt-p2v-pxe-hostkey
/p2v/stamp-test-virt-p2v-pxe-kernel
/p2v/stamp-test-virt-p2v-pxe-userkey
/p2v/stamp-virt-p2v.pod
/p2v/stamp-virt-p2v-make-disk.pod
/p2v/stamp-virt-p2v-make-kickstart.pod
/p2v/stamp-virt-p2v-make-kiwi.pod
/p2v/test-virt-p2v-pxe.authorized_keys
/p2v/test-virt-p2v-pxe.id_rsa
/p2v/test-virt-p2v-pxe.id_rsa.pub
/p2v/test-virt-p2v-pxe.img
/p2v/test-virt-p2v-pxe.initramfs
/p2v/test-virt-p2v-pxe.sshd_config
/p2v/test-virt-p2v-pxe.ssh_host_rsa_key
/p2v/test-virt-p2v-pxe.ssh_host_rsa_key.pub
/p2v/test-virt-p2v-pxe.vmlinuz
/p2v/virt-p2v
/p2v/virt-p2v.1
/p2v/virt-p2v.i686
/p2v/virt-p2v.img
/p2v/virt-p2v-kernel-config.pod
/p2v/virt-p2v-make-disk
/p2v/virt-p2v-make-disk.1
/p2v/virt-p2v-make-kickstart
/p2v/virt-p2v-make-kickstart.1
/p2v/virt-p2v-make-kiwi
/p2v/virt-p2v-make-kiwi.1
/p2v/virt-p2v.xz
/perl/_build
/perl/bindtests.pl
/perl/blib
@@ -499,6 +327,7 @@ Makefile.in
/php/extension/configure.in
/php/extension/env
/php/extension/guestfs_php.c
/php/extension/guestfs_php.dep
/php/extension/install-sh
/php/extension/libtool
/php/extension/ltmain.sh
@@ -519,12 +348,10 @@ Makefile.in
/php/extension/tests/guestfs_*.sh
/php/extension/tests/guestfs_090_bindtests.phpt
/php/extension/tmp-php.ini
/pick-guests.pl
/po-docs/*/*.1
/po-docs/*/*.3
/po-docs/*/*.5
/po-docs/*/*.8
/po-docs/po4a.conf
/po-docs/*/*.pod
/podwrapper.1
/podwrapper.pl
@@ -533,9 +360,6 @@ Makefile.in
/python/actions.h
/python/bindtests.py
/python/build
/python/c-ctype.h
/python/cleanups.c
/python/cleanups.h
/python/config.h
/python/dist
/python/examples/guestfs-python.3
@@ -543,24 +367,18 @@ Makefile.in
/python/guestfs.py
/python/guestfs.pyc
/python/guestfs.pyo
/python/guestfs-internal-all.h
/python/guestfs-utils.h
/python/ignore-value.h
/python/guestfs-stringlists-utils.h
/python/MANIFEST
/python/module.c
/python/stringlists-utils.c
/python/structs.c
/python/__pycache__
/python/setup.py
/python/stamp-extra-files
/python/t/tests_helper.py
/python/utils.c
/rescue/stamp-virt-rescue.pod
/rescue/virt-rescue
/rescue/virt-rescue.1
/resize/.depend
/resize/stamp-virt-resize.pod
/resize/virt-resize
/resize/virt-resize.1
/ruby/bindtests.rb
/ruby/doc/site/api
/ruby/examples/guestfs-ruby.3
@@ -575,22 +393,14 @@ Makefile.in
/ruby/ext/guestfs/mkmf.log
/ruby/Rakefile
/ruby/stamp-rdoc
/rust/Cargo.lock
/rust/Cargo.toml
/rust/**/*.rs.bk
/rust/src/bin/bindtests.rs
/rust/src/guestfs.rs
/rust/target
/run
/sparsify/.depend
/sparsify/stamp-virt-sparsify.pod
/sparsify/virt-sparsify
/sparsify/virt-sparsify.1
/stamp-h1
/sysprep/.depend
/sysprep/stamp-script1.sh
/sysprep/stamp-script2.sh
/sysprep/stamp-script4.sh
/sysprep/stamp-virt-sysprep.pod
/sysprep/sysprep-extra-options.pod
/sysprep/sysprep-operations.pod
/sysprep/sysprep_operation_*.mli
/sysprep/virt-sysprep
/sysprep/virt-sysprep.1
/tests/c-api/test-add-drive-opts
/tests/c-api/test-add-libvirt-dom
/tests/c-api/test-backend-settings
@@ -601,23 +411,22 @@ Makefile.in
/tests/c-api/test-dlopen
/tests/c-api/test-environment
/tests/c-api/test-event-string
/tests/c-api/test*.img
/tests/c-api/test-just-header
/tests/c-api/test-just-header-cxx
/tests/c-api/test-last-errno
/tests/c-api/test.log
/tests/c-api/test-private-data
/tests/c-api/test-pwd
/tests/c-api/tests
/tests/c-api/tests.c
/tests/c-api/test-threads
/tests/c-api/test*.tmp
/tests/c-api/test-user-cancel
/tests/charsets/test-charset-fidelity
/tests/daemon/captive-daemon.pm
/tests/disks/test-add-disks
/tests/disks/test-qemu-drive-libvirt.xml
/tests/events/test-libvirt-auth-callbacks
/tests/functions.sh
/tests/large-command/test-large-command
/tests/mount-local/test-parallel-mount-local
/tests/mountable/test-internal-parse-mountable
/tests/parallel/test-parallel
@@ -625,12 +434,9 @@ Makefile.in
/tests/regressions/rhbz501893
/tests/regressions/rhbz790721
/tests/regressions/rhbz914931
/tests/regressions/rhbz1044014.out
/tests/regressions/rhbz1055452
/tests/regressions/test-big-heap
/tests/rsync/rsyncd.pid
/tests/syslinux/extlinux-guest.img
/tests/syslinux/syslinux-guest.img
/tests/testdownload.tmp
/test-data/test.iso
/test-data/blank-disks/blank-disk-*
/test-data/fake-virtio-win/fake-virtio-win.iso
@@ -646,6 +452,7 @@ Makefile.in
/test-data/files/initrd-x86_64.img
/test-data/files/initrd-x86_64.img.gz
/test-data/files/lib-i586.so.xz
/test-data/files/lib-i586.so.zst
/test-data/files/test-grep.txt.gz
/test-data/phony-guests/archlinux.img
/test-data/phony-guests/blank-*.img
@@ -653,11 +460,11 @@ Makefile.in
/test-data/phony-guests/debian.img
/test-data/phony-guests/fedora.img
/test-data/phony-guests/fedora-btrfs.img
/test-data/phony-guests/fedora-luks.img
/test-data/phony-guests/fedora-luks-on-lvm.img
/test-data/phony-guests/fedora-lvm-on-luks.img
/test-data/phony-guests/fedora-md1.img
/test-data/phony-guests/fedora-md2.img
/test-data/phony-guests/fedora-name.db
/test-data/phony-guests/fedora-packages.db
/test-data/phony-guests/fedora.db
/test-data/phony-guests/guests.xml
/test-data/phony-guests/guests-all-good.xml
/test-data/phony-guests/stamp-fedora-md.img
@@ -669,41 +476,6 @@ Makefile.in
/test-tool/libguestfs-test-tool.1
/test-tool/libguestfs-test-tool-helper
/test-tool/stamp-libguestfs-test-tool.pod
/tools/stamp-virt-*.pod
/tools/virt-*.1
/utils/boot-analysis/boot-analysis
/utils/boot-analysis/boot-analysis.1
/utils/boot-benchmark/boot-benchmark
/utils/boot-benchmark/boot-benchmark.1
/utils/qemu-boot/qemu-boot
/utils/qemu-speed-test/qemu-speed-test
/v2v/.depend
/v2v/config.ml
/v2v/oUnit-*
/v2v/output_rhv_upload_*_source.ml
/v2v/real-*.d/
/v2v/real-*.img
/v2v/real-*.xml
/v2v/stamp-virt-v2v*.pod
/v2v/test-harness/.depend
/v2v/test-harness/META
/v2v/test-harness/stamp-virt-v2v-test-harness.pod
/v2v/test-harness/virt-v2v-test-harness.1
/v2v/test-v2v-conversion-of-*.sh
/v2v/uefi.ml
/v2v/uefi.mli
/v2v/v2v_unit_tests
/v2v/virt-v2v
/v2v/virt-v2v.1
/v2v/virt-v2v-copy-to-local
/v2v/virt-v2v-copy-to-local.1
/v2v/virt-v2v-input-vmware.1
/v2v/virt-v2v-input-xen.1
/v2v/virt-v2v-output-local.1
/v2v/virt-v2v-output-openstack.1
/v2v/virt-v2v-output-rhv.1
/v2v/virt-v2v-support.1
/v2v/windows.vmdk
/website/*.html
/website/README.txt
/website/TODO.txt

6
.gitmodules vendored
View File

@@ -1,3 +1,3 @@
[submodule "gnulib"]
path = .gnulib
url = https://git.savannah.gnu.org/git/gnulib.git
[submodule "common"]
path = common
url = https://github.com/libguestfs/libguestfs-common

3
.gitpublish Normal file
View File

@@ -0,0 +1,3 @@
[gitpublishprofile "default"]
base = master
to = guestfs@lists.libguestfs.org

Submodule .gnulib deleted from 29d8029005

906
BUGS
View File

@@ -1,906 +0,0 @@
NOTE: This file is automatically generated from "update-bugs.sh".
Last updated: 2019-01-16
This contains a local list of the bugs that are open against
libguestfs. Bugs are tracked in the Red Hat Bugzilla database
at https://bugzilla.redhat.com/ and to report a new bug you
should follow this link:
https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
When reporting a new bug, please check:
- That the bug has not been reported already.
- That you are testing a recent version.
- Describe the bug accurately, and give a way to reproduce it.
- Include the version of libguestfs, distro version and any other
relevant information.
- Attach the complete output of "libguestfs-test-tool".
--------------------------------------------------
Bugs in NEW or ASSIGNED state are open and waiting for someone to fix.
547488 NEW https://bugzilla.redhat.com/show_bug.cgi?id=547488
guestfish cannot tab complete filenames that contain spaces
572337 NEW https://bugzilla.redhat.com/show_bug.cgi?id=572337
libguestfs should support gptsync
578103 NEW https://bugzilla.redhat.com/show_bug.cgi?id=578103
[RFE] Tool to Compare Windows Registry Entries
604041 NEW https://bugzilla.redhat.com/show_bug.cgi?id=604041
guestmount absolute symlinks don't work
637251 NEW https://bugzilla.redhat.com/show_bug.cgi?id=637251
virt-inspector fails to recognize data-only NTFS disk image
693064 NEW https://bugzilla.redhat.com/show_bug.cgi?id=693064
Symbolic links on ntfs-3g are not followed correctly by some commands
745576 NEW https://bugzilla.redhat.com/show_bug.cgi?id=745576
libguestfs (or qemu?) hangs if sparse file runs out of disk space
770075 NEW https://bugzilla.redhat.com/show_bug.cgi?id=770075
FEBOOTSTRAP_MODULES fails if modules directory is not under /lib
770076 NEW https://bugzilla.redhat.com/show_bug.cgi?id=770076
FEBOOTSTRAP_KERNEL causes appliance build to fail
785603 NEW https://bugzilla.redhat.com/show_bug.cgi?id=785603
copy-out "No such file or directory"
790837 NEW https://bugzilla.redhat.com/show_bug.cgi?id=790837
Use of atexit to clean up handles is wrong in multithreaded programs
813290 NEW https://bugzilla.redhat.com/show_bug.cgi?id=813290
mdadm (md-detail) test occasionally fails with 'md device /dev/md125 does not appear to be active.'
824021 NEW https://bugzilla.redhat.com/show_bug.cgi?id=824021
inspection cannot recognize guest which uses btrfs subvolumes for root
824782 NEW https://bugzilla.redhat.com/show_bug.cgi?id=824782
[RFE] virt-resize: support mac partition layouts
832602 NEW https://bugzilla.redhat.com/show_bug.cgi?id=832602
"error in chunked encoding" when trying to extract (tar-out) a truncated ISO image
833362 NEW https://bugzilla.redhat.com/show_bug.cgi?id=833362
virt-make-fs test fails on ppc64 because filesystem block size is 64k
835622 NEW https://bugzilla.redhat.com/show_bug.cgi?id=835622
RFE: virt-sparsify should be able to sparsify onto a thin-provisioned LV
845234 NEW https://bugzilla.redhat.com/show_bug.cgi?id=845234
RFE: virt-ls on Windows guest doesn't support drive letters
848464 NEW https://bugzilla.redhat.com/show_bug.cgi?id=848464
gobject javascript bindings cannot use 64 bit integers
848926 NEW https://bugzilla.redhat.com/show_bug.cgi?id=848926
virt-v2v should verify that the RHEV-M domain is an export storage domain
857763 NEW https://bugzilla.redhat.com/show_bug.cgi?id=857763
libguestfs 'file-architecture' returns 'ARM' for arm binaries
866994 NEW https://bugzilla.redhat.com/show_bug.cgi?id=866994
tgz-out causes memory leak in guestfsd
887826 NEW https://bugzilla.redhat.com/show_bug.cgi?id=887826
RFE: virt-sparsify cannot handle multi-disk virtual machines (eg. if they use LVM, MD, LDM, etc)
891909 NEW https://bugzilla.redhat.com/show_bug.cgi?id=891909
Can't make install with non-standard prefix as non-root
895898 NEW https://bugzilla.redhat.com/show_bug.cgi?id=895898
RFE: Allow interface to be specified with libvirt attach-method
895946 NEW https://bugzilla.redhat.com/show_bug.cgi?id=895946
Got incorrect block count number when resize ntfs file system via "ntfsresize_opts"
903987 NEW https://bugzilla.redhat.com/show_bug.cgi?id=903987
Command "acl-set-file" is inconvenient to use
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
913815 NEW https://bugzilla.redhat.com/show_bug.cgi?id=913815
febootstrap: no ext2 root device found when running libguestfs-test-tools
917706 NEW https://bugzilla.redhat.com/show_bug.cgi?id=917706
guestfs_umount_local is not thread safe
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
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
986242 NEW https://bugzilla.redhat.com/show_bug.cgi?id=986242
golang bindings cannot be compiled if golang-guestfs package is installed
987829 NEW https://bugzilla.redhat.com/show_bug.cgi?id=987829
virt-resize error: "lvm_set_filter: vgchange: Couldn't find device with uuid .. Refusing activation of partial LV"
988100 NEW https://bugzilla.redhat.com/show_bug.cgi?id=988100
RFE: journal reader in guestfish
991641 NEW https://bugzilla.redhat.com/show_bug.cgi?id=991641
virt-sysprep fs-uuids plugin doesn't update UUIDs in fstab, elsewhere
991830 NEW https://bugzilla.redhat.com/show_bug.cgi?id=991830
virt-resize throws ambiguous error when /dev/mapper/VG-LV path is used
1025942 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1025942
Parallel virt-df and virt-alignment-scan tests sometimes deadlock
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
1029134 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1029134
Broken links in virt-builder web man page
1033573 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1033573
libguestfs inspection does not recognize NAS4Free OS installed on QCOW2 image
1040912 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1040912
[ARM] mount-local / FUSE support does not seem to work at all
1056047 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1056047
virt-df generates no output for Solaris 11 x86_64 guest.
1057873 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1057873
libguestfs df/ subdirectory tests fail occasionally
1060423 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1060423
Support setting xattrs via FUSE
1061040 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1061040
RFE: Enable ZFS support
1069966 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1069966
RFE: let virt-builder etc build ARM guests on x86 host
1075594 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1075594
RFE: python-libguestfs should be available on pypi
1079734 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1079734
Tiny Core Linux is not recognized by libguestfs inspection
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
1099475 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1099475
sfdisk: BLKRRPART: Device or resource busy
1100138 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1100138
some operation cause "lvremove" can not find the object
1102241 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1102241
[RFE] libguestfs should detect OSTree (project-atomic) qcow2 disk image
1102619 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1102619
lvm-clear-filter failed when has two same name but different uuid's VG
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
1108171 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1108171
RFE: virt-builder should be able to build PXE images for baremetal installation
1113153 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1113153
RFE: Inspection should support systemd mount units
1114012 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1114012
"yum install guestfish" on fresh Fedora 20 results in broken libguestfs
1118305 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1118305
RFE: Ability to set iSCSI-Initiator-IQN for iSCSI connections
1129110 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1129110
Libguestfs NTFS not setting ACLs
1130506 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1130506
RFE: virt-sparsify in copying mode should support qemu detect-zeroes
1134726 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1134726
[RFE] virt-builder should support args with the --run command
1139785 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1139785
virt-sysprep should change UUID fields in /etc/sysconfig/network-scripts/ifcfg-* files
1144137 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1144137
virt-inspector fails on Minix 3 guest
1151902 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1151902
RFE: virt-v2v should do something with <interface type='direct'> (either virtualize it or give an error)
1151903 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1151903
virt tools --csv output should have a meaningful output
1152533 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1152533
RFE: virt-v2v should do something with <disk device='lun'> (either virtualize it or give an error)
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
1173462 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1173462
virt-resize on RHEL 5.7 fails to resize the raw format disk image
1176526 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1176526
virt-resize cannot shrink ext filesystem by a small amount
1177460 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1177460
virt-customize does not work with fedora atomic
1190666 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1190666
virt-builder should get RHEL images from RHN
1195881 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1195881
virt-builder can't docker pull
1197786 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1197786
virt-builder fails --get-kernel on F21 PPC64 iso
1198344 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1198344
[RFE] virt-builder should support download resume
1203816 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1203816
virt-sysprep should error if a command line flag is not used because the operation is disabled
1212507 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1212507
sfdisk-disk-geometry fails to display the disk geometry from the partition
1212546 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1212546
rsync-out fails to synchronize filesystem with remote filesystem
1213274 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1213274
Improve the misunderstanding error messages of virt-tar-in/virt-tar-out/virt-copy-in/virt-copy-out
1213319 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1213319
[RFE]virt-v2v support convert guest with all interface types to others
1213844 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1213844
guestfish should reset the console on ^Z
1215803 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1215803
'/var/lib/random-seed: No such file or directory' with virt-tools on images with bind-mount of /var
1217959 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1217959
journal logging support
1220751 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1220751
fusermount returns EBUSY, but unmounts the disk anyway, confusing guestunmount
1232477 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1232477
guestfs_add_drive_opts incorrectly quotes query parameters
1242028 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1242028
virt-make-fs cannot set g+s bit on vfat
1250670 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1250670
libguestfs-test-tool succeeds but guestmount fails
1253593 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1253593
[RFE]virt-p2v support conversion of citrix xen guest
1277744 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1277744
When VirtualBox is running, libguestfs fails with ioctl(KVM_CREATE_VM) failed: 16 Device or resource busy
1284191 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1284191
virt-builder cgroup error when running docker
1291339 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1291339
[RFE] Add support for layered/composable images in virt-builder repos
1293516 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1293516
rm-rf can not delete files and dirs in symbolic link dir
1308535 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1308535
RFE: v2v: Copy bios.hddOrder to target
1314739 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1314739
The X server of Xen rhel5.11 can't start successfully after converted by virt-p2v
1317180 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1317180
virt-sysprep fails with immutable files
1318922 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1318922
network name mangling after virt-v2v conversion causes old-style network scripts to fail
1322837 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1322837
Setting LIBGUESTFS_HV causes security context to be reset
1336627 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1336627
Convert rhel6.8 x86 iscsi-qla4xxx host by virt-p2v failed with control conversion closed by remote
1337865 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1337865
Part-init and part-add failed to create partition with mac parttype on aarch64
1341619 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1341619
Sendkey"ctrl+alt+delete" is not useful at p2v client GUI mode
1346818 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1346818
RFE: virt-get-kernel should be able to extract the kernel command line too
1347830 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1347830
virt-edit on domains over remote transport attempts to edit a local path
1350762 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1350762
Xterm's scroll bar can't work in p2v client if connect machine via virtual console
1351000 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1351000
virt-customize --commands-from-file will fail if there is an extra blank in the file
1356550 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1356550
QXL driver can't be installed automatically when convert win7 or win2008r2 from kvm to rhev by virt-v2v
1363764 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1363764
Permission problems on disk images result in confusing behavior
1363796 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1363796
[RFE] virt-v2v: add ability to identify source templates and indicate it in output to RHEV
1364058 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1364058
[RFE] virt-v2v should provide an option to store the traces to log file
1365473 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1365473
virt-p2v fails when source machine is using tboot (Intel Trusted Boot pre-kernel module)
1368599 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1368599
pip install fails with ImportError: /usr/lib64/python2.7/site-packages/libguestfsmod.so: undefined symbol: put_isoinfo
1369010 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1369010
v2v UEFI conversions fail if the source has a bus='ide' CD-ROM
1372037 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1372037
txz-in hangs on btrfs filesystem
1374254 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1374254
Failed to boot up Win7sp1 for first time which installed on fc hardware after converting to rhv4.0
1374629 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1374629
virt-p2v sees LCDRIVE & virtual floppy as hard disks, they are in fact removable
1383048 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1383048
Device.map which is /dev/sdb or /dev/mapper/mpatha can't be updated to vda after p2v conversion
1393747 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1393747
RFE: Libguestfs should support LUKS partition in guest image
1398191 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1398191
RFE: virt-v2v should support converting vm with LUKS disk encryption format
1400332 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1400332
RFE: virt-builder should support templates with encrypted filesystems
1405273 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1405273
RFE: virt-builder should support a URL as the output diskimage
1415955 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1415955
Ubuntu 14 doesn't generate ssh host keys during first boot
1420103 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1420103
[RFE] Hyper-V support in v2v
1435162 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1435162
virt-v2v: allow libvirt backend for xen+ssh
1443655 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1443655
Ability to convert Virtual Machines to use virtio_scsi
1443955 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1443955
There is error info about permission denied when convert a guest from vmx file by virt-v2v
1445659 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1445659
RFE: convert Windows UEFI guests from VMware to OpenStack Glance
1446540 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1446540
File system remains read-only after executing virt-tar-out
1449126 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1449126
is there a command to get the blocks offset of data of a file?
1449734 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1449734
libguestfs configure script looks at build perl for host perl availability
1449813 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1449813
RFE: Add support in virt-v2v for writing directly to block device rather to image file
1450732 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1450732
RFE: virt-sparsify does not support URLs
1451597 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1451597
Ubuntu guest can't obtain ip after converting from vmware to rhv/kvm by virt-v2v
1455087 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1455087
Failed to restart network service in rhel6 guest after converting to glance by virt-v2v
1459816 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1459816
Origin info shows incorrect when convert guest from disk to rhv by virt-v2v
1460168 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1460168
Failed to restart network service after converting rhel6 guest from disk by virt-v2v
1461983 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1461983
part-to-dev and part-to-partnum APIs are buggy when the device name ends with a number
1465323 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1465323
virt-customize cannot set random seed for fresh Debian 9 guests
1465526 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1465526
RuntimeError: mount_ro: /dev/cl/root on / (options: 'ro'): mount: mount /dev/mapper/cl-root on /sysroot failed: Structure needs cleaning
1468535 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1468535
Device.map can't be updated to vda if import rhel7.4 guest from kvm source at rhv4.1
1468540 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1468540
Windows guest's storage/display can't be updated to virtio/qxl driver normmaly if import windows guest from kvm source at rhv4.1
1472039 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1472039
RFE: virt-resize should be able to cope with crazy non-monotonic partition ordering used by Ubuntu
1490300 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1490300
guestmount fails on directory with a million entries
1492633 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1492633
The older kernel will be used in rhel7 guest after finishing v2v converting sometimes
1496767 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1496767
Should not appear to choose boot option info in the conversion when to convert opensuse42.3 guest by virt-v2v
1499896 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1499896
9pnet_virtio module is not loaded automatically
1507624 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1507624
Failed to run virt-sparsify on a disk containing lvs
1507872 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1507872
Physical machine can't boot into virt-p2v client when machine's BIOS is on UEFI mode
1507901 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1507901
Can't input password for encrypted partition of physical machine's os during virt-p2v conversion
1508275 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1508275
Virt-v2v should add a warning info if input a wrong password when convert a guest which has encrypted partition.
1508299 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1508299
Virt-v2v can't convert rhel7.4 guest whose OS is installed on software RAID with UEFI mode
1509931 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1509931
[RFE] v2v: UEFI support in RHV export
1511778 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1511778
Guest couldn't boot normally when convert a uefi windows guest by virt-v2v if virtio-win package not installed on virt-v2v server
1513839 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1513839
virt-v2v support for RHEL Atomic
1514782 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1514782
No rule to make target 'sysprep-extra-options.pod', needed by 'virt-sysprep.1'
1515044 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1515044
Virt-p2v can't convert a non-EFI host if its partitions replaces a EFI system's partition during installing OS
1517969 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1517969
v2v from VMWare fails with 401 unauthorize while reading vmdk disk
1518539 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1518539
Macvtap network will be lost during v2v conversion
1519737 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1519737
Please stop using netpbm tools to extract windows icons
1525131 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1525131
Virt-v2v can't convert rhel7 guest whose partitions have different encrypted luks
1527003 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1527003
mkfs fat with blocksize:512 does not set the block size correctly
1528523 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1528523
v2v should update the grub2 configuration and give guest a valid grub2 configuration
1531563 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1531563
virt-resize --expand of disk with gpt table results in invalid disk
1532491 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1532491
virt-diff produces empty diff output if either of the files being compared is a binary file
1533761 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1533761
Full-virturalization rhel5 guest can't boot into os after v2v converting from Xen host if original guest's default kernel is xen kernel
1536762 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1536762
Misuse of JNI by libguestfs Java bindings
1540898 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1540898
/bin/bash: error while loading shared libraries: /lib64/libshellaudit: cannot open shared object file: No such file or directory
1541181 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1541181
Cannot mount read only filesystem in a running image
1543923 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1543923
guestunmount takes 30 seconds to figure out a mount doesn't exist
1552247 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1552247
[RFE] Add native support for KubeVirt to virt-v2v
1554357 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1554357
Conversion from VDDK source fails with VDDK read errors SSL: syscall error 104: Connection reset by peer
1554546 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1554546
virt-customize always creates an /etc/machine-id
1554735 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1554735
RFE: customize --selinux-relabel should be the default, with --no-selinux-relabel used to opt out
1557042 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1557042
virt-sysprep 'customize' operation creates /etc/machine-id even if the machine-id operation just removed it
1560935 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1560935
[RFE] Add libosinfo short-id to virt-v2v output
1564530 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1564530
[RFE] Add native support for KubeVirt to virt-v2v
1564885 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1564885
guestmount ignores AppArmor and the setting "security_require_confined = 1"
1571239 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1571239
RFE: virt-v2v should be able to use rhev-apt from tools ISO
1575523 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1575523
RFE: Virt-builder-repository should create configure file automatically for user
1582543 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1582543
libguestfs: error: qemu-img info: testakv1.vmdk: qemu-img info exited with error status 1
1585810 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1585810
Virt-v2v resolves VMware provider to IPv6 address causing migration failures
1590395 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1590395
RFE: Add 'vgextend' to guestfish interface
1590721 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1590721
There is virt-v2v warning about CPU during p2v conversion if set vCPU number less than actual number of host CPU
1591155 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1591155
RFE: virt-v2v -it ssh: Provide a way to disable host key checking or provide MD5 hash of the server
1592870 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1592870
Too many Requests should be aggregated
1595209 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1595209
V2V can't parse guest's cpu topology correctly after converting guest from VMX to libvirt when original guest has multiple sockets and 1 core
1595688 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1595688
Virtio driver can't be installed on network automatically in win2012r2 guest after virt-v2v converting from vmware to libvirt on rhel7.6
1598586 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1598586
[RFE] Support v2v to q35 only
1598826 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1598826
Error handling in golang bindings is fundamentally broken
1600547 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1600547
Disk configuration (RAW Sparse) is incompatible with the storage domain type.
1600743 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1600743
filesystem type unknow for lvm root fs
1601824 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1601824
Virt-v2v should create the guest firstly then uploads the disks secondly during rhv-upload conversion
1603149 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1603149
[RFE] Support rhv-upload in virt-p2v
1605242 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1605242
Update nbdkit info for vddk in v2v man page
1607115 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1607115
guestfish copy-in fails as no OS is detected
1607274 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1607274
RFE: Add virt-v2v --mac option
1607840 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1607840
Improve the error message when using virt-v2v+qemu_kvm and rhv-upload option
1609155 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1609155
virt-sparsify failed to sparsify free space with "file" as temporary space on ppc64le
1609614 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1609614
Cannot power on guest on rhv4.2 which is converted from host by virt-p2v if if converted guest has ovirtmgmt bridge
1609618 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1609618
Can NOT restart network in guest after converting aacraid-win2012r2 host to rhv by virt-p2v
1609795 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1609795
Can't launch p2v client if build virt-p2v bootable USB key by virt-p2v-maker
1611913 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1611913
OpenSUSE 10virt-v2v thinks devices are "sdX" instead of "hdX"
1612653 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1612653
Guest has no disk after rhv-upload converting if target data domain has similar name with other data domain on rhv4.2
1613265 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1613265
Virt-v2v can't convert rhel6 guest which has encrypted swap partition
1614502 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1614502
No rule to make target '../builder/index-parse.c', needed by 'libguestfs.pot'. Stop.
1614765 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1614765
Can't cancel conversion on p2v client if the v2v conversion server is ovirt node
1614947 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1614947
Bad /etc/apt/sources.list for Ubuntu 18.04 using vert-builder
1615252 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1615252
Service NetworkManager cannot be started on virt-p2v client when using BCM5719 Gigabit Ethernet
1616226 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1616226
The disk is not cleaned up in ovirt when image_transfer job fails in some condition
1617785 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1617785
RFE: Both systems should login successfully after converting a dual os system vm
1619665 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1619665
RFE: virt-v2v: Install ovirt-guest-agent-common on Linux guests being migrated to RHV
1619805 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1619805
Log error response from oVirt server in rhv-upload-plugin
1620313 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1620313
firstboot commands do not run properly on Windows 2012 guest
1621895 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1621895
Rebase libguestfs in RHEL 7.7
1626181 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1626181
virt-customize -d $vm --update breaks vm
1626503 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1626503
Unable to maintain static IP address configuration post VM migration
1627654 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1627654
Delete the symbolic link that leads to nowhere
1627676 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1627676
Cannot boot into system after converting HP Smart Array P408i-a SR Gen10 host to KVM managed by libvirt by virt-p2v
1627964 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1627964
guestfs-python error occur when `import guestfs` on centos 7.5(centos 1804) use python3.
1632456 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1632456
libguestfs-test-tool stops with "unknown file type in supermin directory"
1636144 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1636144
-it vddk -io vddk-snapshot with bogus snapshot ID does not fail
1642040 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1642040
virt-p2v should give better message when /var/tmp isn't writable
1645037 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1645037
cirros 0.4.0 is not recognized by libguestfs inspection
1645546 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1645546
virt-v2v should support importing Oracle Xen OVA files
1647657 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1647657
guestfs_setxattr() doesn't work for binary values
1648403 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1648403
Running guestfish under a vmware hypervisor fails with default configuration
1650414 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1650414
[RFE] Add native support for KubeVirt to virt-v2v
1650415 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1650415
[RFE] Add libosinfo short-id to virt-v2v output - Fast Train
1651207 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1651207
About the Windows VM rhsrvany.exe boot service problem
1651446 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1651446
RFE: Add support for changing system locale with virt-customize(1)
1651447 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1651447
RFE: Add support for changing system keyboard with virt-customize(1)
1655088 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1655088
centos 7 l reports: error while loading shared libraries: liblz4.so.1
1656532 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1656532
virt-builder update fails if after ssh-inject
1657151 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1657151
Build issue in libguestfs 1.36.10 on RHEL 6
1657713 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1657713
RFE: virt-v2v: Implement NBD support for -o rhv-upload mode
1658307 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1658307
virt-builder --hostname foo.bar ubuntu-18.04 fails to set FQDN
1659211 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1659211
virt-p2v: Conversion failed: NBD server error: timed out waiting for NBD server to start
1661428 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1661428
guestmount: changes on a VMDK are not commited after unmount
1661871 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1661871
Icon created by libguestfs-tools cannot been displayed on virt-manager
1662286 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1662286
[virt-p2v] Windows 2019 with Dynamic Disks, set to "offline" after p2v conversion to RHV
1662483 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1662483
[RHEL 7.6 LP] virt-v2v -o rhv-upload fail with "NameError: global name 'cafile' is not defined"
1663434 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1663434
pip packages (at http://download.libguestfs.org/python/) are configured for Python 2 only
1664711 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1664711
libguestfs direct backend shouldn't attempt to quote commas in -append parameter
1665802 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1665802
[RFE] Extend virt-v2v-wrapper to support CNV as a target provider
1665804 NEW https://bugzilla.redhat.com/show_bug.cgi?id=1665804
[RFE] Add support for CNV as a target provider for virt-v2v
503134 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=503134
guestfish's list splitting does not recognize internal quoting
539746 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=539746
launch fails when run inside a Xen guest, when no non-PV kernels are installed
541618 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=541618
guestfish not able to mount freebsd ufs2 partitions automatically
619334 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=619334
RFE: Enable coredump capture in the appliance
691389 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=691389
SELinux labels don't work over guestmount (FUSE)
1143887 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1143887
virt-v2v: warning: cannot write files to the NFS server as 36:36
1468509 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1468509
Failed to import and convert guest from kvm source if guest's disk type is volume at rhv4.1
1594351 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1594351
[v2v][RFE] Reduced downtime migrations (warm migrations)
1650413 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1650413
[v2v][RFE] Reduced downtime migrations (warm migrations)
1651500 ASSIGNED https://bugzilla.redhat.com/show_bug.cgi?id=1651500
v2v - support for -insecure option to support OSP SSL connection for VM migrations
(259 bugs)
--------------------------------------------------
Bugs in MODIFIED, POST or ON_QA state are fixed.
You can help by testing the fixes.
1144138 POST https://bugzilla.redhat.com/show_bug.cgi?id=1144138
virt-inspector fails on FreeBSD 9.3 guest
1379585 POST https://bugzilla.redhat.com/show_bug.cgi?id=1379585
guestfish mistakely parse nbd exportname
1384241 POST https://bugzilla.redhat.com/show_bug.cgi?id=1384241
The tar-in command does not allow restoring file capabilities
1409024 POST https://bugzilla.redhat.com/show_bug.cgi?id=1409024
[Debian] Missing db_dump abort inspection
1465849 POST https://bugzilla.redhat.com/show_bug.cgi?id=1465849
v2v hangs on removing vmware-tool
1481930 POST https://bugzilla.redhat.com/show_bug.cgi?id=1481930
[RFE] v2v: uninstall VMware tools that were installed from tarball
1527334 POST https://bugzilla.redhat.com/show_bug.cgi?id=1527334
Various -it vddk -io vddk* options should be documented, removed or fixed
1530967 POST https://bugzilla.redhat.com/show_bug.cgi?id=1530967
Change categories of "Guest Operating system management by VIX API" in v2v man page
1598350 POST https://bugzilla.redhat.com/show_bug.cgi?id=1598350
RFE: virt-v2v should preserve <genid>
1605071 POST https://bugzilla.redhat.com/show_bug.cgi?id=1605071
On machines where /dev/kvm exists but KVM doesn't work, libguestfs will not fall back to TCG
1614276 POST https://bugzilla.redhat.com/show_bug.cgi?id=1614276
VixDiskLib: VixDiskLib_Read: Read 4096 sectors at 57516160 failed. Error 2 (Memory allocation failed. Out of memory.) (DiskLib error 802: NBD_ERR_INSUFFICIENT_RESOURCES) at 5240.
1622785 POST https://bugzilla.redhat.com/show_bug.cgi?id=1622785
[RFE] [v2v] Provide a tool/flag to estimate data size to be migrated
1624878 POST https://bugzilla.redhat.com/show_bug.cgi?id=1624878
Update v2v docs to describe support for SHA 2 certs required for converting Windows 7 and 2008 R2 guests
1624902 POST https://bugzilla.redhat.com/show_bug.cgi?id=1624902
Fix rhev-apt command that virt-v2v runs in Windows guests on first boot
1634248 POST https://bugzilla.redhat.com/show_bug.cgi?id=1634248
virt-v2v cannot convert opensuse15 guest
1642044 POST https://bugzilla.redhat.com/show_bug.cgi?id=1642044
[RFE] virt-p2v UI should give the option to shutdown after conversion is finished
1651432 POST https://bugzilla.redhat.com/show_bug.cgi?id=1651432
v2v - support for -insecure option to support OSP SSL connection for VM migrations
1561828 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1561828
RHV tools not properly installed in migrated Windows VM's causing boot failure
1620594 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1620594
RFE: virt-v2v: Install qemu-guest-agent on Linux guests being migrated to RHV
1664310 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1664310
[RHEL 7.6 LP] openstack output leaks passwords
1664318 MODIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1664318
Upgrade libguestfs package to 1.39.14
1650264 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1650264
v2v - virt-v2v-wrapper support for SSL without validation for OSP
1651426 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1651426
v2v - OSP admin password exposed in virt-v2v-wrapper logs
1655640 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1655640
[Rebase] Rebase libguestfs to libguestfs-1.38.2-12.el7_6.1.24.lp.el7ev
1665911 ON_QA https://bugzilla.redhat.com/show_bug.cgi?id=1665911
[Rebase] Rebase libguestfs to libguestfs-1.38.2-12.28.lp.el7ev
(25 bugs)
--------------------------------------------------
These bugs are in the VERIFIED state.
1165564 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1165564
Provide Reboot/Shutdown button after virt-p2v
1165569 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1165569
Disable "cancel conversion" button after virt-p2v conversion finished
1358332 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1358332
virt-p2v to become supported tool in RHEL 7.3
1653315 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1653315
[Rebase] Rebase libguestfs to libguestfs-1.38.2-12.26.lp.el7ev
1655946 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1655946
virt-v2v cannot convert opensuse15 guest
1657652 VERIFIED https://bugzilla.redhat.com/show_bug.cgi?id=1657652
Change categories of "Guest Operating system management by VIX API" in v2v man page
(6 bugs)
End of BUGS file.

View File

@@ -1,5 +1,5 @@
# libguestfs
# Copyright (C) 2009-2019 Red Hat Inc.
# Copyright (C) 2009-2025 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,77 +22,29 @@ ACLOCAL_AMFLAGS = -I m4
# The generator - must be before anything else.
SUBDIRS = common/mlstdutils generator
# Must be the first tests that run.
if ENABLE_APPLIANCE
SUBDIRS += tests/qemu
endif
# Files and other test data used by the tests. Must be before any
# tests run, except tests/qemu.
# tests run.
SUBDIRS += test-data
# Gnulib - must be built and tested before the library.
SUBDIRS += gnulib/lib
if ENABLE_GNULIB_TESTS
SUBDIRS += gnulib/tests
endif
# Basic source for the library.
SUBDIRS += gnulib/lib
SUBDIRS += common/errnostring common/protocol common/qemuopts
SUBDIRS += common/utils
SUBDIRS += common/structs
SUBDIRS += lib docs examples po
SUBDIRS += include lib docs examples
# The daemon and the appliance.
SUBDIRS += common/mlutils
SUBDIRS += common/mlaugeas
SUBDIRS += common/mlpcre
if ENABLE_DAEMON
SUBDIRS += daemon
SUBDIRS += tests/daemon
endif
if ENABLE_APPLIANCE
SUBDIRS += appliance
endif
# Tests - order is important.
if ENABLE_APPLIANCE
SUBDIRS += tests/c-api
SUBDIRS += tests/tmpdirs
SUBDIRS += tests/protocol
SUBDIRS += tests/events
SUBDIRS += tests/parallel
SUBDIRS += tests/create
SUBDIRS += tests/disks
SUBDIRS += tests/discard
SUBDIRS += tests/mountable
SUBDIRS += tests/network
SUBDIRS += tests/lvm
SUBDIRS += tests/luks
SUBDIRS += tests/md
SUBDIRS += tests/selinux
SUBDIRS += tests/relabel
SUBDIRS += tests/ntfs
SUBDIRS += tests/btrfs
SUBDIRS += tests/xfs
SUBDIRS += tests/charsets
SUBDIRS += tests/xml
SUBDIRS += tests/mount-local
SUBDIRS += tests/9p
SUBDIRS += tests/rsync
SUBDIRS += tests/bigdirs
SUBDIRS += tests/disk-labels
SUBDIRS += tests/hotplug
SUBDIRS += tests/nbd
SUBDIRS += tests/http
SUBDIRS += tests/syslinux
SUBDIRS += tests/journal
SUBDIRS += tests/relative-paths
SUBDIRS += tests/gdisk
SUBDIRS += tests/regressions
SUBDIRS += tests/tsk
SUBDIRS += tests/yara
endif
# Tests.
SUBDIRS += tests
# Common code used by the tools.
SUBDIRS += common/edit
@@ -102,17 +54,8 @@ SUBDIRS += common/progress
SUBDIRS += common/visit
SUBDIRS += common/windows
# libguestfs-test-tool
SUBDIRS += test-tool
# Guestfish.
SUBDIRS += fish
# virt-tools in C.
SUBDIRS += align cat diff df edit format inspector make-fs rescue
if HAVE_P2V
SUBDIRS += common/miniexpect p2v
endif
# Small tools written in C.
SUBDIRS += test-tool fish rescue
# bash-completion
SUBDIRS += bash
@@ -151,52 +94,20 @@ endif
if HAVE_GOLANG
SUBDIRS += golang golang/examples
endif
if HAVE_RUST
SUBDIRS += rust
endif
# Unconditional because nothing is built yet.
SUBDIRS += csharp
# OCaml tools. Note 'common/ml*' and 'customize' contain shared code
# used by other OCaml tools, so these must come first.
if HAVE_OCAML
SUBDIRS += common/mlgettext
SUBDIRS += common/mlprogress
SUBDIRS += common/mlvisit
SUBDIRS += common/mlxml
SUBDIRS += common/mltools
SUBDIRS += customize
SUBDIRS += builder builder/templates
SUBDIRS += get-kernel
SUBDIRS += resize
SUBDIRS += sparsify
SUBDIRS += sysprep
SUBDIRS += v2v
if HAVE_OCAML_PKG_LIBVIRT
SUBDIRS += v2v/test-harness
endif
if HAVE_FUSE
SUBDIRS += dib
endif
endif
# Perl tools.
if HAVE_TOOLS
SUBDIRS += tools
endif
# guestmount
if HAVE_FUSE
SUBDIRS += fuse
endif
# Miscellaneous utilities.
if HAVE_BOOT_ANALYSIS
SUBDIRS += utils/boot-analysis
endif
SUBDIRS += \
utils/boot-benchmark \
utils/max-disks \
utils/qemu-boot \
utils/qemu-speed-test
# After all source files were used we can generate the translation strings
SUBDIRS += po
# po-docs must come after tools, inspector.
if HAVE_PO4A
@@ -204,16 +115,17 @@ SUBDIRS += po-docs
endif
EXTRA_DIST = \
AUTHORS BUGS HACKING RELEASES TODO \
AUTHORS HACKING TODO \
.github/workflows/main.yml \
.gitignore \
.gitpublish \
.lvimrc \
.mailmap \
bootstrap \
bugs-in-changelog.sh \
autogen.sh \
bindtests \
cfg.mk \
check-mli.sh \
common/.gitignore \
common/README \
contrib/autobuild/autobuild.sh \
contrib/intro/libguestfs-intro.html \
contrib/intro/overview.png \
@@ -226,11 +138,6 @@ EXTRA_DIST = \
contrib/intro/vmm-icons-t.png \
contrib/intro/vmm-icons.png \
contrib/intro/win7.xml \
contrib/p2v/aux-scripts/do-build.sh \
contrib/p2v/build-p2v-iso.sh \
contrib/p2v/patches/0001-RHEL-5-ONLY-DISABLE-AUTOMATIC-REMOTE-PORT-ALLOCATION.patch \
contrib/p2v/patches/0002-RHEL-5-ONLY-QEMU-NBD-1.4-HAS-NO-f-OPTION.patch \
contrib/p2v/test-p2v-iso.sh \
contrib/README \
contrib/visualize-alignment/.gitignore \
contrib/visualize-alignment/guestfish-add-mount.qtr \
@@ -246,36 +153,27 @@ EXTRA_DIST = \
libtool-kill-dependency_libs.sh \
logo/fish.svg logo/fish.png \
logo/fish-5yrs.svg logo/fish-5yrs.png \
logo/fish-10yrs.svg logo/fish-10yrs.png \
logo/virt-builder.svg \
m4/.gitignore \
ocaml-link.sh \
podcheck.pl \
tests/automake2junit.ml \
tests/test-functions.sh \
tmp/.gitignore \
update-bugs.sh \
utils/README \
valgrind-suppressions \
website/bugs.png \
website/communicate.png \
website/documentation.png \
website/download.png \
website/download/builder/README \
website/download/builder/index \
website/download/builder/index.asc \
website/draft.png \
website/draft.svg \
website/easytoread.css \
website/feed.css \
website/fish-5yrs.svg \
website/fish-10yrs.svg \
website/fish.png \
website/git.png \
website/index.css \
website/index.html.in \
website/pod.css \
website/standard.css \
zanata.xml \
zanata-pull.sh
website/standard.css
WEBSITESDIR = $(HOME)/d/websites
@@ -301,39 +199,26 @@ maintainer-upload-website:
# When doing 'make dist' update a few files automatically.
#
# BUGS - list of bugs (created from Bugzilla)
# ChangeLog - changelog (created from git)
# docs/C_SOURCE_FILES
# - source files scanned for internal documentation
# po/POTFILES - files with ordinary extensions, but not OCaml files
# po/POTFILES-pl - Perl files that don't end in *.pl, which need a
# special xgettext option [not generated here]
# po/POTFILES-ml - OCaml files, which need a special tool to translate
# po-docs/libguestfs-docs.pot
# - combined list of strings from documentation
dist-hook: BUGS ChangeLog docs/C_SOURCE_FILES po/POTFILES po/POTFILES-ml
cp BUGS $(distdir)/BUGS
cp ChangeLog $(distdir)/ChangeLog
BUGS: configure.ac
rm -f $@ $@-t
unset LC_ALL; \
$(top_srcdir)/update-bugs.sh > $@-t
mv $@-t $@
ChangeLog: configure.ac
rm -f $@ $@-t
git log --decorate=false > $@-t
mv $@-t $@
dist-hook: docs/C_SOURCE_FILES po/POTFILES
rm -f po-docs/libguestfs-docs.pot
$(MAKE) -C po-docs libguestfs-docs.pot
# This has to be in the top-level Makefile.am so that we have access
# to DIST_SUBDIRS.
docs/C_SOURCE_FILES: configure.ac
rm -f $@ $@-t
find $(DIST_SUBDIRS) -name '*.[ch]' | \
grep -v -E '^(builder/index-parse\.|builder/index-scan\.|examples/|gnulib/|gobject/|java/com_redhat_et_libguestfs|perl/|php/extension/config\.h|ruby/ext/guestfs/extconf\.h|tests/|test-data/)' | \
grep -v -E '^(builder/index-parse\.|builder/index-scan\.|examples/|gobject/|java/com_redhat_et_libguestfs|perl/|php/extension/config\.h|ruby/ext/guestfs/extconf\.h|tests/|test-data/)' | \
grep -v -E '/(guestfs|rc)_protocol\.' | \
grep -v -E '.*/errnostring\.' | \
grep -v -E '.*-gperf\.' | \
grep -v -E '/dummy.c$$' | \
LC_ALL=C sort -u > $@-t
mv $@-t $@
@@ -341,23 +226,15 @@ docs/C_SOURCE_FILES: configure.ac
po/POTFILES: configure.ac
rm -f $@ $@-t
cd $(srcdir); \
find $(DIST_SUBDIRS) -name '*.c' -o -name '*.pl' -o -name '*.pm' | \
grep -v -E '^(examples|gnulib|perl/(blib|examples)|po-docs|tests|test-data)/' | \
grep -v -E '/((guestfs|rc)_protocol\.c)$$' | \
find $(DIST_SUBDIRS) -name '*.c' | \
grep -v -E '^(examples|perl/(blib|examples)|po-docs|tests|test-data)/' | \
grep -v -E '/((guestfs|rc)_protocol\.c|dummy\.c)$$' | \
grep -v -E '^python/utils\.c$$' | \
grep -v -E '^perl/lib/Sys/Guestfs\.c$$' | \
grep -v -E '.*-(tests|gperf)\.c$$' | \
LC_ALL=C sort -u > $@-t
mv $@-t $@
po/POTFILES-ml: configure.ac
rm -f $@ $@-t
cd $(srcdir); \
find builder common/ml* customize dib get-kernel resize sparsify sysprep v2v -name '*.ml' | \
grep -v '^builder/templates/' | \
grep -v '^v2v/config.ml$$' | \
LC_ALL=C sort > $@-t
mv $@-t $@
# Try to stop people using 'make install' without 'DESTDIR'.
install:
@if test "x$(DESTDIR)" != "x" || test "x$(REALLY_INSTALL)" = "xyes"; \
@@ -421,11 +298,8 @@ check-all:
$(MAKE) -j1 \
check \
check-valgrind \
check-valgrind-local-guests \
check-direct \
check-valgrind-direct \
check-uml \
check-valgrind-uml \
check-with-upstream-qemu \
check-with-upstream-libvirt \
check-slow
@@ -447,15 +321,6 @@ check-valgrind: build-test-guests
done; \
exit $$(( $$errors ? 1 : 0 ))
check-valgrind-local-guests:
@GUESTS=`$(top_builddir)/run ./pick-guests.pl 5`; \
errors=0; \
for f in `grep -l '^$@:' $(SUBDIRS:%=%/Makefile.am)`; do \
echo $(MAKE) GUESTS="$$GUESTS" -C `dirname $$f` $@; \
$(MAKE) GUESTS="$$GUESTS" -C `dirname $$f` $@ || (( errors++ )); \
done; \
exit $$(( $$errors ? 1 : 0 ))
check-direct:
@backend=`$(top_builddir)/run ./fish/guestfish get-backend`; \
if [ "$$backend" != "direct" ]; then \
@@ -472,24 +337,6 @@ check-valgrind-direct:
check-valgrind-with-appliance: check-valgrind-direct
# Tests which currently fail under UML:
# - blockdev --setro seems to have no effect on /dev/ubd* devices [*]
# - RHBZ#914931: test is sent a SIGTERM, apparently by UML [*]
# - tests/md/test-inspect-fstab-md.sh hangs at various places during the
# test, eg. running mdadm, mounting MD filesystem [*]
# [*] = likely to be a bug in UML itself
SKIP_TESTS_FAILING_IN_UML = \
SKIP_TEST_BLOCKDEV_GETRO=1 \
SKIP_TEST_BLOCKDEV_SETRO=1 \
SKIP_TEST_RHBZ914931=1 \
SKIP_TEST_INSPECT_FSTAB_MD_SH=1
check-uml:
$(MAKE) LIBGUESTFS_BACKEND=uml $(SKIP_TESTS_FAILING_IN_UML) check
check-valgrind-uml:
$(MAKE) LIBGUESTFS_BACKEND=uml $(SKIP_TESTS_FAILING_IN_UML) check-valgrind
QEMUDIR = $(HOME)/d/qemu
QEMUBINARY = $(QEMUDIR)/x86_64-softmmu/qemu-system-x86_64
@@ -592,17 +439,25 @@ maintainer-check-authors:
maintainer-check-extra-dist:
zcat $(PACKAGE_NAME)-$(VERSION).tar.gz | tar tf - | sort | \
sed 's,^$(PACKAGE_NAME)-$(VERSION)/,,' > tmp/tarfiles
git ls-files | \
( git ls-files ; \
cd common; git ls-files | sed 's,^,common/,' ) | \
grep -v '^common$$' | \
grep -v '^common/mlcustomize/' | \
grep -v '^common/mldrivers/' | \
grep -v '^common/mlgettext/' | \
grep -v '^common/mlprogress/' | \
grep -v '^common/mltools/' | \
grep -v '^common/mlvisit/' | \
grep -v '^common/mlxml/' | \
grep -v '^intltool-.*\.in' | \
grep -v '^\.gitmodules' | \
grep -v '^\.gnulib' | \
sort > tmp/gitfiles
comm -13 tmp/tarfiles tmp/gitfiles > tmp/comm-out
@echo Checking for differences between EXTRA_DIST and git ...
cat tmp/comm-out
[ ! -s tmp/comm-out ]
@echo Checking for generated files missing from the tarball ...
@for f in `cat generator/files-generated.txt`; do \
@for f in `cat generator/files-generated.txt | grep -v '^common/mlcustomize'`; do \
if ! grep -sq "^$$f\$$" tmp/tarfiles; then \
echo generated file missing from tarball: $$f; \
exit 1; \
@@ -621,11 +476,8 @@ help:
@echo "make -k check ... and display all errors at once."
@echo
@echo "make check-valgrind Run a subset of the tests under valgrind."
@echo "make check-valgrind-local-guests Test under valgrind using local guests."
@echo "make check-direct Test using direct backend."
@echo "make check-valgrind-direct Test valgrind + direct backend."
@echo "make check-uml Test using User-Mode Linux."
@echo "make check-valgrind-uml Test valgrind + User-Mode Linux."
@echo "make check-with-upstream-qemu Test using upstream qemu."
@echo "make check-with-upstream-libvirt Test using upstream libvirt."
@echo "make check-slow Slow/long-running tests."

4
README
View File

@@ -6,7 +6,7 @@ disk images. For more information see the home page:
For discussion, development, patches, etc. please use the mailing
list:
http://www.redhat.com/mailman/listinfo/libguestfs
https://lists.libguestfs.org
To find out how to build libguestfs from source, read:
@@ -14,7 +14,7 @@ To find out how to build libguestfs from source, read:
http://libguestfs.org/guestfs-building.1.html
man docs/guestfs-building.1
Copyright (C) 2009-2019 Red Hat Inc.
Copyright (C) 2009-2025 Red Hat Inc.
The library is distributed under the LGPLv2+. The programs are
distributed under the GPLv2+. Please see the files COPYING and

921
RELEASES
View File

@@ -1,921 +0,0 @@
# This file contains the release date of each version of libguestfs
# in the form <version> <date>. If you update the version field (in
# configure.ac) you must also add the current date to this file.
1.40.0 2019-01-15
1.39.14 2018-12-12
1.39.13 2018-12-11
1.39.12 2018-12-11
1.39.11 2018-09-21
1.39.9 2018-08-28
1.39.8 2018-07-27
1.39.7 2018-07-13
1.39.6 2018-06-28
1.39.5 2018-05-21
1.39.4 2018-05-01
1.39.3 2018-04-20
1.39.2 2018-03-29
1.39.1 2018-03-13
1.38.0 2018-02-07
1.37.37 2018-02-06
1.37.36 2018-01-25
1.37.35 2017-12-09
1.37.34 2017-11-16
1.37.33 2017-11-16
1.37.32 2017-11-15
1.37.31 2017-10-17
1.37.30 2017-10-16
1.37.29 2017-10-06
1.37.28 2017-09-28
1.37.27 2017-09-22
1.37.26 2017-09-16
1.37.25 2017-09-15
1.37.24 2017-09-14
1.37.23 2017-09-14
1.37.22 2017-09-04
1.37.21 2017-08-09
1.37.20 2017-08-03
1.37.19 2017-07-27
1.37.18 2017-07-18
1.37.17 2017-07-10
1.37.16 2017-06-22
1.37.14 2017-05-18
1.37.13 2017-05-08
1.37.12 2017-04-25
1.37.11 2017-04-13
1.37.10 2017-04-11
1.37.9 2017-04-06
1.37.8 2017-03-30
1.37.7 2017-03-24
1.37.6 2017-03-20
1.37.2 2017-03-13
1.37.1 2017-03-07
1.37.0 2017-02-28
1.36.5 2017-06-22
1.36.4 2017-05-19
1.36.3 2017-03-24
1.36.2 2017-03-07
1.36.1 2017-02-28
1.35.28 2017-02-24
1.35.27 2017-02-22
1.35.26 2017-02-21
1.35.25 2017-02-15
1.35.24 2017-02-11
1.35.23 2017-02-10
1.35.22 2017-02-10
1.35.21 2017-02-07
1.35.20 2017-01-27
1.35.19 2016-12-23
1.35.18 2016-12-14
1.35.17 2016-12-11
1.35.14 2016-10-25
1.35.9 2016-10-20
1.35.8 2016-10-11
1.35.6 2016-09-23
1.35.5 2016-09-12
1.35.4 2016-09-02
1.35.3 2016-09-01
1.34.6 2017-03-08
1.34.4 2017-01-29
1.34.3 2016-10-27
1.34.2 2016-09-01
1.34.0 2016-08-08
1.33.49 2016-08-04
1.33.46 2016-07-27
1.33.45 2016-07-22
1.33.44 2016-07-19
1.33.43 2016-07-14
1.33.42 2016-07-09
1.33.41 2016-07-06
1.33.40 2016-07-01
1.33.39 2016-06-23
1.33.38 2016-06-18
1.33.37 2016-06-17
1.33.36 2016-06-13
1.33.35 2016-06-06
1.33.34 2016-06-03
1.33.32 2016-05-27
1.33.31 2016-05-26
1.33.30 2016-05-23
1.33.29 2016-05-17
1.33.28 2016-05-09
1.33.27 2016-05-04
1.33.26 2016-05-03
1.33.24 2016-04-30
1.33.23 2016-04-24
1.33.20 2016-04-14
1.33.19 2016-04-12
1.33.18 2016-04-05
1.33.16 2016-03-24
1.33.15 2016-03-16
1.33.14 2016-03-07
1.33.13 2016-02-26
1.33.12 2016-02-12
1.33.11 2016-02-09
1.33.10 2016-02-08
1.33.9 2016-02-05
1.33.8 2016-02-03
1.33.7 2016-01-29
1.33.6 2016-01-27
1.33.5 2016-01-26
1.33.4 2016-01-22
1.33.1 2016-01-11
1.32.10 2016-09-01
1.32.7 2016-08-08
1.32.6 2016-07-12
1.32.5 2016-06-01
1.32.4 2016-04-05
1.32.3 2016-02-26
1.32.2 2016-01-29
1.32.1 2016-01-15
1.32.0 2016-01-06
1.31.30 2015-12-16
1.31.29 2015-12-05
1.31.28 2015-11-25
1.31.27 2015-11-19
1.31.26 2015-11-13
1.31.25 2015-11-06
1.31.24 2015-11-04
1.31.23 2015-10-31
1.31.22 2015-10-30
1.31.20 2015-10-25
1.31.19 2015-10-20
1.31.18 2015-10-20
1.31.17 2015-10-15
1.31.16 2015-10-09
1.31.15 2015-10-08
1.31.13 2015-10-07
1.31.11 2015-10-05
1.31.10 2015-10-04
1.31.9 2015-09-30
1.31.8 2015-09-29
1.31.7 2015-09-20
1.31.6 2015-09-11
1.31.5 2015-09-08
1.31.4 2015-09-03
1.31.3 2015-08-28
1.31.2 2015-08-13
1.31.1 2015-07-30
1.31.0 2015-07-21
1.30.6 2015-12-15
1.30.4 2015-10-25
1.30.3 2015-10-06
1.30.2 2015-09-08
1.30.1 2015-08-14
1.30.0 2015-07-21
1.29.50 2015-07-09
1.29.49 2015-07-02
1.29.48 2015-06-29
1.29.47 2015-06-18
1.29.46 2015-06-06
1.29.44 2015-05-26
1.29.43 2015-05-15
1.29.42 2015-05-14
1.29.41 2015-05-11
1.29.40 2015-05-06
1.29.39 2015-05-02
1.29.38 2015-04-27
1.29.37 2015-04-23
1.29.36 2015-04-16
1.29.34 2015-04-10
1.29.33 2015-04-01
1.29.32 2015-03-27
1.29.31 2015-03-23
1.29.30 2015-03-10
1.29.29 2015-03-05
1.29.26 2015-02-17
1.29.25 2015-02-11
1.29.24 2015-02-02
1.29.23 2015-01-26
1.29.22 2015-01-21
1.29.20 2015-01-17
1.29.19 2014-12-23
1.29.18 2014-12-16
1.29.17 2014-12-15
1.29.14 2014-12-11
1.29.13 2014-12-05
1.29.12 2014-11-28
1.29.11 2014-11-27
1.29.10 2014-11-25
1.29.9 2014-11-20
1.29.8 2014-11-18
1.29.7 2014-11-15
1.29.6 2014-11-06
1.29.5 2014-11-05
1.29.4 2014-10-31
1.29.3 2014-10-30
1.29.2 2014-10-25
1.29.1 2014-10-22
1.28.12 2015-07-16
1.28.10 2015-05-06
1.28.9 2015-04-26
1.28.7 2015-03-28
1.28.6 2015-02-03
1.28.5 2014-12-18
1.28.4 2014-11-30
1.28.3 2014-11-15
1.28.2 2014-10-27
1.28.1 2014-10-18
1.27.64 2014-10-17
1.27.63 2014-10-15
1.27.62 2014-10-10
1.27.61 2014-10-09
1.27.60 2014-10-08
1.27.58 2014-10-02
1.27.57 2014-10-01
1.27.56 2014-09-29
1.27.55 2014-09-26
1.27.54 2014-09-24
1.27.53 2014-09-23
1.27.50 2014-09-19
1.27.49 2014-09-18
1.27.48 2014-09-17
1.27.47 2014-09-16
1.27.46 2014-09-15
1.27.45 2014-09-14
1.27.44 2014-09-12
1.27.43 2014-09-11
1.27.42 2014-09-10
1.27.41 2014-09-09
1.27.39 2014-09-06
1.27.38 2014-09-05
1.27.37 2014-09-04
1.27.36 2014-09-02
1.27.35 2014-09-01
1.27.34 2014-08-29
1.27.33 2014-08-29
1.27.31 2014-08-24
1.27.30 2014-08-21
1.27.28 2014-08-19
1.27.27 2014-08-15
1.27.26 2014-08-13
1.27.25 2014-08-05
1.27.24 2014-07-26
1.27.23 2014-07-23
1.27.22 2014-07-21
1.27.21 2014-07-08
1.27.20 2014-07-02
1.27.19 2014-06-24
1.27.18 2014-06-16
1.27.16 2014-06-13
1.27.15 2014-06-11
1.27.14 2014-05-30
1.27.13 2014-05-24
1.27.12 2014-05-23
1.27.11 2014-05-16
1.27.10 2014-05-15
1.27.9 2014-05-07
1.27.8 2014-05-02
1.27.7 2014-04-23
1.27.6 2014-04-22
1.27.5 2014-04-15
1.27.4 2014-04-15
1.27.3 2014-04-06
1.27.2 2014-03-31
1.27.0 2014-03-27
1.26.10 2015-02-21
1.26.9 2014-09-04
1.26.8 2014-08-25
1.26.7 2014-07-31
1.26.6 2014-07-26
1.26.5 2014-07-04
1.26.3 2014-05-24
1.26.2 2014-05-07
1.26.1 2014-04-22
1.26.0 2014-03-27
1.25.49 2014-03-26
1.25.47 2014-03-25
1.25.46 2014-03-20
1.25.45 2014-03-16
1.25.44 2014-03-13
1.25.43 2014-03-08
1.25.42 2014-03-06
1.25.41 2014-03-03
1.25.40 2014-03-03
1.25.39 2014-03-01
1.25.37 2014-02-21
1.25.36 2014-02-17
1.25.34 2014-02-12
1.25.33 2014-02-05
1.25.32 2014-02-04
1.25.31 2014-01-28
1.25.29 2014-01-25
1.25.27 2014-01-23
1.25.26 2014-01-22
1.25.25 2014-01-21
1.25.24 2014-01-18
1.25.23 2014-01-17
1.25.21 2014-01-13
1.25.20 2014-01-12
1.25.19 2014-01-02
1.25.18 2013-12-18
1.25.15 2013-12-14
1.25.14 2013-12-12
1.25.13 2013-12-08
1.25.12 2013-12-02
1.25.11 2013-11-23
1.25.7 2013-11-08
1.25.6 2013-11-05
1.25.3 2013-11-01
1.25.2 2013-10-29
1.25.1 2013-10-26
1.25.0 2013-10-19
1.24.9 2015-02-21
1.24.8 2014-03-08
1.24.6 2014-02-12
1.24.5 2014-01-20
1.24.4 2014-01-02
1.24.3 2013-12-18
1.24.2 2013-12-06
1.24.1 2013-11-01
1.24.0 2013-10-19
1.23.33 2013-10-15
1.23.32 2013-10-14
1.23.31 2013-10-12
1.23.30 2013-10-11
1.23.28 2013-10-08
1.23.27 2013-10-05
1.23.25 2013-10-04
1.23.23 2013-09-27
1.23.22 2013-09-10
1.23.21 2013-09-06
1.23.20 2013-09-01
1.23.19 2013-08-29
1.23.18 2013-08-19
1.23.17 2013-08-14
1.23.16 2013-08-13
1.23.15 2013-08-11
1.23.14 2013-08-06
1.23.13 2013-08-03
1.23.12 2013-07-30
1.23.11 2013-07-28
1.23.10 2013-07-23
1.23.9 2013-07-18
1.23.8 2013-07-09
1.23.7 2013-07-03
1.23.6 2013-06-26
1.23.5 2013-06-18
1.23.4 2013-06-14
1.23.3 2013-06-10
1.23.2 2013-06-03
1.23.1 2013-05-28
1.22.9 2014-02-12
1.22.7 2013-10-17
1.22.6 2013-08-24
1.22.5 2013-07-26
1.22.4 2013-07-09
1.22.3 2013-06-14
1.22.2 2013-06-03
1.22.1 2013-05-28
1.22.0 2013-05-23
1.21.40 2013-05-21
1.21.39 2013-05-15
1.21.38 2013-05-11
1.21.37 2013-05-09
1.21.36 2013-05-02
1.21.35 2013-04-30
1.21.34 2013-04-29
1.21.33 2013-04-25
1.21.32 2013-04-23
1.21.31 2013-04-17
1.21.30 2013-04-16
1.21.29 2013-04-13
1.21.28 2013-04-09
1.21.27 2013-04-04
1.21.26 2013-04-02
1.21.25 2013-03-30
1.21.24 2013-03-29
1.21.23 2013-03-28
1.21.22 2013-03-18
1.21.21 2013-03-15
1.21.20 2013-03-13
1.21.19 2013-03-11
1.21.18 2013-03-07
1.21.17 2013-03-05
1.21.16 2013-03-01
1.21.15 2013-02-26
1.21.14 2013-02-25
1.21.13 2013-02-20
1.21.12 2013-02-19
1.21.11 2013-02-14
1.21.10 2013-02-11
1.21.9 2013-02-09
1.21.8 2013-02-05
1.21.7 2013-02-04
1.21.6 2013-01-28
1.21.5 2013-01-21
1.21.4 2013-01-18
1.21.3 2013-01-17
1.21.2 2012-12-22
1.21.1 2012-12-17
1.20.12 2013-10-17
1.20.11 2013-08-27
1.20.10 2013-07-26
1.20.9 2013-06-14
1.20.8 2013-06-03
1.20.7 2013-05-28
1.20.6 2013-04-11
1.20.5 2013-03-31
1.20.4 2013-03-12
1.20.3 2013-03-05
1.20.2 2013-02-14
1.20.1 2012-12-20
1.20.0 2012-12-13
1.19.66 2012-12-01
1.19.65 2012-11-29
1.19.64 2012-11-24
1.19.63 2012-11-23
1.19.62 2012-11-20
1.19.61 2012-11-19
1.19.60 2012-11-17
1.19.59 2012-11-13
1.19.58 2012-11-10
1.19.57 2012-11-07
1.19.56 2012-11-02
1.19.55 2012-10-30
1.19.54 2012-10-29
1.19.53 2012-10-19
1.19.52 2012-10-14
1.19.51 2012-10-11
1.19.50 2012-10-10
1.19.49 2012-10-09
1.19.48 2012-10-07
1.19.46 2012-10-01
1.19.45 2012-09-26
1.19.44 2012-09-24
1.19.43 2012-09-21
1.19.42 2012-09-17
1.19.41 2012-09-16
1.19.40 2012-09-04
1.19.39 2012-09-04
1.19.38 2012-09-03
1.19.37 2012-08-31
1.19.36 2012-08-30
1.19.35 2012-08-29
1.19.34 2012-08-28
1.19.33 2012-08-21
1.19.32 2012-08-18
1.19.31 2012-08-15
1.19.30 2012-08-14
1.19.29 2012-08-11
1.19.28 2012-08-02
1.19.27 2012-07-30
1.19.26 2012-07-26
1.19.25 2012-07-24
1.19.24 2012-07-23
1.19.23 2012-07-22
1.19.22 2012-07-19
1.19.21 2012-07-18
1.19.20 2012-07-17
1.19.19 2012-07-16
1.19.18 2012-07-09
1.19.17 2012-07-06
1.19.16 2012-07-04
1.19.15 2012-06-29
1.19.14 2012-06-28
1.19.13 2012-06-26
1.19.12 2012-06-26
1.19.11 2012-06-25
1.19.10 2012-06-22
1.19.9 2012-06-18
1.19.8 2012-06-14
1.19.7 2012-06-13
1.19.6 2012-06-12
1.19.5 2012-06-09
1.19.4 2012-06-07
1.19.3 2012-06-01
1.19.2 2012-05-28
1.19.1 2012-05-25
1.19.0 2012-05-21
1.18.12 2013-04-11
1.18.11 2012-11-22
1.18.10 2012-10-30
1.18.9 2012-10-01
1.18.8 2012-09-19
1.18.7 2012-08-30
1.18.6 2012-08-05
1.18.5 2012-07-10
1.18.4 2012-07-07
1.18.3 2012-06-28
1.18.2 2012-06-21
1.18.1 2012-06-01
1.18.0 2012-05-21
1.17.43 2012-05-17
1.17.42 2012-05-13
1.17.41 2012-05-11
1.17.40 2012-05-08
1.17.39 2012-05-03
1.17.38 2012-05-01
1.17.37 2012-05-01
1.17.36 2012-04-26
1.17.35 2012-04-25
1.17.34 2012-04-24
1.17.33 2012-04-22
1.17.32 2012-04-17
1.17.31 2012-04-15
1.17.30 2012-04-13
1.17.29 2012-04-12
1.17.28 2012-04-11
1.17.27 2012-04-10
1.17.26 2012-04-03
1.17.25 2012-04-02
1.17.24 2012-04-01
1.17.23 2012-04-01
1.17.22 2012-03-29
1.17.21 2012-03-21
1.17.20 2012-03-17
1.17.19 2012-03-16
1.17.18 2012-03-15
1.17.17 2012-03-14
1.17.16 2012-03-13
1.17.15 2012-03-12
1.17.14 2012-03-09
1.17.13 2012-03-08
1.17.12 2012-03-07
1.17.11 2012-03-05
1.17.10 2012-03-03
1.17.9 2012-02-29
1.17.8 2012-02-15
1.17.7 2012-02-13
1.17.6 2012-02-10
1.17.5 2012-02-08
1.17.4 2012-02-01
1.17.3 2012-01-27
1.17.2 2012-01-26
1.17.1 2012-01-24
1.16.35 2013-04-11
1.16.34 2012-11-22
1.16.33 2012-10-30
1.16.32 2012-10-01
1.16.31 2012-09-19
1.16.30 2012-08-30
1.16.29 2012-08-05
1.16.28 2012-07-10
1.16.27 2012-07-07
1.16.26 2012-06-28
1.16.25 2012-06-21
1.16.24 2012-06-01
1.16.23 2012-05-18
1.16.22 2012-05-14
1.16.21 2012-05-01
1.16.20 2012-04-24
1.16.19 2012-04-17
1.16.18 2012-04-13
1.16.17 2012-04-11
1.16.16 2012-04-10
1.16.15 2012-04-03
1.16.14 2012-04-02
1.16.13 2012-03-30
1.16.12 2012-03-23
1.16.11 2012-03-16
1.16.10 2012-03-13
1.16.9 2012-03-08
1.16.8 2012-03-05
1.16.7 2012-03-03
1.16.6 2012-03-01
1.16.5 2012-02-13
1.16.4 2012-02-10
1.16.3 2012-02-08
1.16.2 2012-01-30
1.16.1 2012-01-24
1.16.0 2012-01-23
1.15.19 2012-01-22
1.15.18 2012-01-19
1.15.17 2012-01-18
1.15.16 2012-01-10
1.15.15 2012-01-06
1.15.14 2011-12-23
1.15.13 2011-12-22
1.15.12 2011-12-22
1.15.11 2011-12-09
1.15.10 2011-12-06
1.15.9 2011-12-03
1.15.8 2011-11-29
1.15.7 2011-11-29
1.15.6 2011-11-24
1.15.5 2011-11-21
1.15.4 2011-11-17
1.15.3 2011-11-09
1.15.2 2011-11-03
1.15.1 2011-11-01
1.15.0 2011-10-27
1.14.10 2012-01-23
1.14.9 2012-01-10
1.14.8 2011-12-22
1.14.7 2011-12-09
1.14.6 2011-12-06
1.14.5 2011-12-02
1.14.4 2011-11-24
1.14.3 2011-11-22
1.14.2 2011-11-09
1.14.1 2011-10-31
1.14.0 2011-10-27
1.13.26 2011-10-26
1.13.25 2011-10-26
1.13.24 2011-10-24
1.13.23 2011-10-20
1.13.22 2011-10-19
1.13.21 2011-10-14
1.13.20 2011-10-11
1.13.19 2011-10-08
1.13.18 2011-10-05
1.13.17 2011-10-04
1.13.16 2011-10-01
1.13.15 2011-09-28
1.13.14 2011-09-24
1.13.13 2011-09-21
1.13.12 2011-09-14
1.13.11 2011-09-01
1.13.10 2011-08-28
1.13.9 2011-08-26
1.13.8 2011-08-26
1.13.7 2011-08-23
1.13.6 2011-08-18
1.13.5 2011-08-17
1.13.4 2011-08-11
1.13.3 2011-08-07
1.13.2 2011-08-02
1.13.1 2011-07-26
1.12.11 2011-12-22
1.12.10 2011-11-10
1.12.9 2011-10-31
1.12.8 2011-10-19
1.12.7 2011-09-16
1.12.6 2011-09-01
1.12.5 2011-08-28
1.12.4 2011-08-17
1.12.3 2011-08-07
1.12.2 2011-07-27
1.12.1 2011-07-26
1.12.0 2011-07-20
1.11.20 2011-07-19
1.11.19 2011-07-18
1.11.18 2011-07-15
1.11.17 2011-07-14
1.11.16 2011-07-13
1.11.15 2011-07-12
1.11.14 2011-07-06
1.11.13 2011-06-30
1.11.12 2011-06-28
1.11.11 2011-06-21
1.11.10 2011-06-10
1.11.9 2011-06-04
1.11.8 2011-05-18
1.11.7 2011-05-17
1.11.6 2011-05-12
1.11.5 2011-05-09
1.11.4 2011-05-08
1.11.3 2011-04-22
1.11.2 2011-04-18
1.11.1 2011-04-16
1.11.0 2011-04-12
1.10.12 2011-12-22
1.10.11 2011-11-09
1.10.10 2011-10-31
1.10.9 2011-09-16
1.10.8 2011-08-17
1.10.7 2011-08-07
1.10.6 2011-07-27
1.10.5 2011-07-13
1.10.4 2011-06-13
1.10.3 2011-05-18
1.10.2 2011-04-24
1.10.1 2011-04-18
1.10.0 2011-04-12
1.9.18 2011-04-09
1.9.17 2011-04-05
1.9.16 2011-04-01
1.9.15 2011-04-01
1.9.14 2011-03-28
1.9.13 2011-03-24
1.9.12 2011-03-18
1.9.11 2011-03-15
1.9.10 2011-03-08
1.9.9 2011-03-04
1.9.8 2011-02-06
1.9.7 2011-01-30
1.9.6 2011-01-22
1.9.5 2011-01-18
1.9.4 2011-01-15
1.9.3 2011-01-11
1.9.2 2011-01-03
1.9.1 2010-12-31
1.9.0 2010-12-19
1.8.16 2011-12-22
1.8.15 2011-11-09
1.8.14 2011-10-31
1.8.13 2011-09-16
1.8.12 2011-08-17
1.8.11 2011-08-07
1.8.10 2011-07-27
1.8.9 2011-07-16
1.8.8 2011-06-13
1.8.7 2011-05-18
1.8.6 2011-04-18
1.8.5 2011-04-11
1.8.4 2011-03-29
1.8.3 2011-03-21
1.8.2 2011-03-08
1.8.1 2011-01-10
1.8.0 2010-12-19
1.7.24 2010-12-16
1.7.23 2010-12-12
1.7.22 2010-12-11
1.7.21 2010-12-10
1.7.20 2010-12-07
1.7.19 2010-12-05
1.7.18 2010-12-01
1.7.17 2010-11-30
1.7.16 2010-11-26
1.7.15 2010-11-26
1.7.14 2010-11-25
1.7.13 2010-11-24
1.7.12 2010-11-23
1.7.11 2010-11-19
1.7.10 2010-11-17
1.7.9 2010-11-16
1.7.8 2010-11-15
1.7.7 2010-11-15
1.7.6 2010-11-13
1.7.5 2010-11-12
1.7.4 2010-11-11
1.7.3 2010-11-08
1.7.2 2010-11-05
1.7.1 2010-11-03
1.7.0 2010-11-02
1.6.2 2010-11-18
1.6.1 2010-11-05
1.6.0 2010-11-02
1.5.26 2010-10-29
1.5.25 2010-10-28
1.5.24 2010-10-27
1.5.23 2010-10-22
1.5.22 2010-10-19
1.5.21 2010-10-01
1.5.20 2010-09-26
1.5.19 2010-09-22
1.5.18 2010-09-22
1.5.17 2010-09-21
1.5.16 2010-09-15
1.5.15 2010-09-15
1.5.14 2010-09-14
1.5.13 2010-09-13
1.5.12 2010-09-11
1.5.11 2010-09-10
1.5.10 2010-09-09
1.5.9 2010-09-08
1.5.8 2010-09-04
1.5.7 2010-09-01
1.5.6 2010-08-27
1.5.5 2010-08-26
1.5.4 2010-08-24
1.5.3 2010-08-17
1.5.2 2010-07-22
1.5.1 2010-07-21
1.5.0 2010-07-08
1.4.6 2010-10-23
1.4.5 2010-09-08
1.4.4 2010-08-27
1.4.3 2010-08-26
1.4.2 2010-08-17
1.4.1 2010-07-12
1.4.0 2010-07-08
1.3.21 2010-06-16
1.3.20 2010-06-08
1.3.19 2010-06-04
1.3.18 2010-06-02
1.3.17 2010-05-27
1.3.16 2010-05-25
1.3.15 2010-05-25
1.3.14 2010-05-24
1.3.13 2010-05-15
1.3.12 2010-05-14
1.3.11 2010-05-08
1.3.10 2010-05-07
1.3.9 2010-04-30
1.3.8 2010-04-27
1.3.7 2010-04-23
1.3.6 2010-04-22
1.3.5 2010-04-19
1.3.4 2010-04-17
1.3.3 2010-04-12
1.3.2 2010-04-10
1.3.1 2010-04-08
1.3.0 2010-03-30
1.2.14 2010-10-23
1.2.13 2010-09-08
1.2.12 2010-08-26
1.2.11 2010-08-17
1.2.10 2010-07-12
1.2.9 2010-06-02
1.2.8 2010-05-24
1.2.7 2010-05-17
1.2.6 2010-05-14
1.2.5 2010-04-30
1.2.4 2010-04-23
1.2.3 2010-04-20
1.2.2 2010-04-12
1.2.1 2010-04-08
1.2.0 2010-03-30
1.0.89 2010-03-30
1.0.88 2010-03-26
1.0.87 2010-03-23
1.0.86 2010-03-12
1.0.85 2010-03-01
1.0.84 2010-02-12
1.0.83 2010-02-05
1.0.82 2010-01-28
1.0.81 2010-01-13
1.0.80 2009-12-16
1.0.79 2009-11-18
1.0.78 2009-11-10
1.0.77 2009-11-03
1.0.76 2009-10-29
1.0.75 2009-10-29
1.0.74 2009-10-20
1.0.73 2009-10-14
1.0.72 2009-09-23
1.0.71 2009-09-22
1.0.70 2009-09-15
1.0.69 2009-09-14
1.0.68 2009-08-19
1.0.67 2009-08-13
1.0.66 2009-08-06
1.0.65 2009-07-29
1.0.64 2009-07-23
1.0.63 2009-07-23
1.0.62 2009-07-17
1.0.61 2009-07-15
1.0.60 2009-07-14
1.0.59 2009-07-14
1.0.58 2009-07-10
1.0.57 2009-07-10
1.0.56 2009-07-07
1.0.55 2009-07-02
1.0.54 2009-06-29
1.0.53 2009-06-24
1.0.52 2009-06-24
1.0.51 2009-06-22
1.0.50 2009-06-22
1.0.49 2009-06-19
1.0.48 2009-06-16
1.0.47 2009-06-15
1.0.46 2009-06-15
1.0.45 2009-06-12
1.0.44 2009-06-10
1.0.43 2009-06-09
1.0.42 2009-06-06
1.0.41 2009-06-04
1.0.40 2009-06-04
1.0.39 2009-06-04
1.0.38 2009-06-02
1.0.37 2009-05-29
1.0.36 2009-05-28
1.0.35 2009-05-28
1.0.34 2009-05-27
1.0.33 2009-05-27
1.0.32 2009-05-26
1.0.31 2009-05-21
1.0.30 2009-05-21
1.0.29 2009-05-21
1.0.28 2009-05-21
1.0.27 2009-05-19
1.0.26 2009-05-18
1.0.25 2009-05-12
1.0.24 2009-05-12
1.0.23 2009-05-11
1.0.22 2009-05-09
1.0.21 2009-05-08
1.0.20 2009-05-07
1.0.19 2009-05-07
1.0.18 2009-05-01
1.0.17 2009-04-30
1.0.16 2009-04-30
1.0.15 2009-04-28
1.0.14 2009-04-26
1.0.13 2009-04-26
1.0.12 2009-04-24
1.0.11 2009-04-23
1.0.10 2009-04-22
1.0.9 2009-04-22
1.0.8 2009-04-22
1.0.7 2009-04-22
1.0.6 2009-04-22
1.0.5 2009-04-21
1.0.4 2009-04-20
1.0.3 2009-04-20
1.0.2 2009-04-20
1.0.1 2009-04-18
1.0.0 2009-04-16
0.9.9 2009-04-15
0.9.3 2009-04-15
0.9.2 2009-04-15
0.9.1 2009-04-14
0.9 2009-04-13
0.8.1 2009-04-12
0.8 2009-04-09
0.7 2009-04-09
0.6 2009-04-08
0.5 2009-04-07
0.4 2009-04-04
0.3 2009-04-04

86
TODO
View File

@@ -75,20 +75,6 @@ Such as:
initrd-extract
initrd-replace
virt-rescue pty
---------------
See:
http://search.cpan.org/~rgiersig/IO-Tty-1.08/Pty.pm
http://www.perlmonks.org/index.pl?node_id=582185
Note that pty requires cooperation inside the C code too (there are
two sides to a pty, and one has to be handled after the fork).
[I tried to implement this in the new C virt-rescue, but it doesn't
work. qemu is implementing its own ptys, and they are broken. Need
to fix qemu.]
Port to Windows
---------------
@@ -175,16 +161,6 @@ Could we make guestfish interactive if commands are used without params?
Image name? disk.img
Size of image? 10M
Better support for encrypted devices
------------------------------------
Currently LUKS support only works if the device contains volume
groups. If it contains, eg., partitions, you cannot access them.
We would like to add:
- Direct access to the /dev/mapper device (eg. if it contains
anything apart from VGs).
Display image as PS
-------------------
@@ -203,6 +179,19 @@ might be replaced by direct use of the library (if this is easier).
But it is very hard to be compatible between RHEL6 and RHEL5 when
using the library directly.
Properly fix device name translation
------------------------------------
Currently for Device parameters we pass a string name like "/dev/sda"
or "/dev/sdb2" or "/dev/VG/LV" to the daemon. Since Linux broke
device enumeration (RHBZ#1804207) this works less well, requiring
non-trivial translation within the daemon.
It would be far better if in the generator we mapped "/dev/XXX" to a
proper structure. Device index + partition | LV | MD | ...
This would be then used everywhere inside the daemon and mean we would
no longer need device name translation at all.
Visualization
-------------
@@ -495,14 +484,6 @@ this approach works, it doesn't solve the MBR problem, so likely we'd
have to write a library for that (or perhaps go back to sfdisk but
using a very abstracted interface over sfdisk).
Reimplement some APIs to avoid protocol limits
----------------------------------------------
Mostly this item was done (eg. commits a69f44f56f and before). The
most notable API with a protocol limit remaining is:
- guestfs_readdir
hivex
-----
@@ -543,11 +524,6 @@ virt-builder
- /etc/resolv.conf handling works but is best described as a hack:
https://github.com/libguestfs/libguestfs/commit/9521422ce60578f7196cc8b7977d998159238c19
- let's make UML work
+ SLIRP is insecure, but we could allow just a bare web proxy which
gets proxied over virtio-serial to the outside world (except
virtio-serial can't be multiplexed)
- sometimes (not always) aug_init takes ages, why?
Midnight Commander (mc) extension
@@ -570,39 +546,3 @@ Subsecond handling in virt-diff, virt-ls
Handle nanoseconds properly. You should be able to specify them on
the command line and display them.
virt-v2v -o rhv-upload
----------------------
* Set or disable the ticket timeout. The default is going to be
increased (from current 60 seconds), so maybe we won't have to
set it. See also:
https://bugzilla.redhat.com/show_bug.cgi?id=1563278
* qcow2 cannot be supported yet because there is not yet any
concept in imageio of read+write handles.
https://bugzilla.redhat.com/show_bug.cgi?id=1563299
* preallocated cannot be supported yet because imageio doesn't
know how to zero the image efficiently, instead it runs an
fallocate process which writes to every block and that takes
many minutes.
* Really check what insecure/rhv_cafile do and implement it correctly.
* Measure and resolve performance problems.
* Allocated image size is unknown for v2v uploads, but imageio needs
to know it. We pass initial_size == provisioned_size == virtual size.
That can't be fixed from the v2v side.
* There are unresolved issues about how to clean up disks on failure.
virt-v2v -o openstack
---------------------
Use the metadata service to find the -oo server-id setting. It would
no longer need to be specified on the command line. Note there are
two variations of metadata service in OpenStack, either the config
disk or link-local network address. We would need to support both, or
the possibility that there is no metadata service.

View File

@@ -1,92 +0,0 @@
# libguestfs virt alignment tools
# Copyright (C) 2011 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.
include $(top_srcdir)/subdir-rules.mk
EXTRA_DIST = \
test-virt-alignment-scan.sh \
test-virt-alignment-scan-docs.sh \
test-virt-alignment-scan-guests.sh \
virt-alignment-scan.pod
bin_PROGRAMS = virt-alignment-scan
virt_alignment_scan_SOURCES = \
scan.c
virt_alignment_scan_CPPFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \
-I$(top_srcdir)/common/options -I$(top_builddir)/common/options \
-I$(top_srcdir)/common/parallel -I$(top_builddir)/common/parallel \
-I$(srcdir)/../gnulib/lib -I../gnulib/lib \
-DLOCALEBASEDIR=\""$(datadir)/locale"\"
virt_alignment_scan_CFLAGS = \
-pthread \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(LIBXML2_CFLAGS) \
$(LIBVIRT_CFLAGS)
virt_alignment_scan_LDADD = \
$(top_builddir)/common/options/liboptions.la \
$(top_builddir)/common/parallel/libparallel.la \
$(top_builddir)/common/structs/libstructs.la \
$(top_builddir)/common/utils/libutils.la \
$(top_builddir)/lib/libguestfs.la \
$(LIBXML2_LIBS) \
$(LIBVIRT_LIBS) \
$(LTLIBINTL) \
../gnulib/lib/libgnu.la \
-lm
# Manual pages and HTML files for the website.
man_MANS = virt-alignment-scan.1
noinst_DATA = $(top_builddir)/website/virt-alignment-scan.1.html
virt-alignment-scan.1 $(top_builddir)/website/virt-alignment-scan.1.html: stamp-virt-alignment-scan.pod
stamp-virt-alignment-scan.pod: virt-alignment-scan.pod
$(PODWRAPPER) \
--man virt-alignment-scan.1 \
--html $(top_builddir)/website/virt-alignment-scan.1.html \
--license GPLv2+ \
--warning safe \
$<
touch $@
# Tests.
TESTS_ENVIRONMENT = $(top_builddir)/run --test
TESTS = \
test-virt-alignment-scan-docs.sh
if ENABLE_APPLIANCE
TESTS += \
test-virt-alignment-scan.sh
if HAVE_LIBVIRT
TESTS += \
test-virt-alignment-scan-guests.sh
endif
endif
check-valgrind:
$(MAKE) VG="@VG@" check

View File

@@ -1,376 +0,0 @@
/* virt-alignment-scan
* Copyright (C) 2011 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.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <inttypes.h>
#include <unistd.h>
#include <getopt.h>
#include <errno.h>
#include <error.h>
#include <locale.h>
#include <assert.h>
#include <libintl.h>
#include <pthread.h>
#ifdef HAVE_LIBVIRT
#include <libvirt/libvirt.h>
#include <libvirt/virterror.h>
#endif
#include "getprogname.h"
#include "guestfs.h"
#include "structs-cleanups.h"
#include "options.h"
#include "display-options.h"
#include "parallel.h"
#include "domains.h"
/* This just needs to be larger than any alignment we care about. */
static size_t worst_alignment = UINT_MAX;
static pthread_mutex_t worst_alignment_mutex = PTHREAD_MUTEX_INITIALIZER;
static int scan (guestfs_h *g, const char *prefix, FILE *fp);
#ifdef HAVE_LIBVIRT
static int scan_work (guestfs_h *g, size_t i, FILE *fp);
#endif
/* These globals are shared with options.c. */
guestfs_h *g;
int read_only = 1;
int live = 0;
int verbose = 0;
int keys_from_stdin = 0;
int echo_keys = 0;
const char *libvirt_uri = NULL;
int inspector = 0;
int in_guestfish = 0;
int in_virt_rescue = 0;
static int quiet = 0; /* --quiet */
static int uuid = 0; /* --uuid */
static void __attribute__((noreturn))
usage (int status)
{
if (status != EXIT_SUCCESS)
fprintf (stderr, _("Try %s --help for more information.\n"),
getprogname ());
else {
printf (_("%s: check alignment of virtual machine partitions\n"
"Copyright (C) 2011 Red Hat Inc.\n"
"Usage:\n"
" %s [--options] -d domname\n"
" %s [--options] -a disk.img [-a disk.img ...]\n"
"Options:\n"
" -a|--add image Add image\n"
" -c|--connect uri Specify libvirt URI for -d option\n"
" -d|--domain guest Add disks from libvirt guest\n"
" --format[=raw|..] Force disk format for -a option\n"
" --help Display brief help\n"
" -P nr_threads Use at most nr_threads\n"
" -q|--quiet No output, just exit code\n"
" --uuid Print UUIDs instead of names\n"
" -v|--verbose Verbose messages\n"
" -V|--version Display version and exit\n"
" -x Trace libguestfs API calls\n"
"For more information, see the manpage %s(1).\n"),
getprogname (), getprogname (),
getprogname (), getprogname ());
}
exit (status);
}
int
main (int argc, char *argv[])
{
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEBASEDIR);
textdomain (PACKAGE);
enum { HELP_OPTION = CHAR_MAX + 1 };
static const char options[] = "a:c:d:P:qvVx";
static const struct option long_options[] = {
{ "add", 1, 0, 'a' },
{ "connect", 1, 0, 'c' },
{ "domain", 1, 0, 'd' },
{ "format", 2, 0, 0 },
{ "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' },
{ 0, 0, 0, 0 }
};
struct drv *drvs = NULL;
const char *format = NULL;
bool format_consumed = true;
int c;
int option_index;
int exit_code;
size_t max_threads = 0;
int r;
g = guestfs_create ();
if (g == NULL)
error (EXIT_FAILURE, errno, "guestfs_create");
for (;;) {
c = getopt_long (argc, argv, options, long_options, &option_index);
if (c == -1) break;
switch (c) {
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")) {
OPTION_format;
} else if (STREQ (long_options[option_index].name, "uuid")) {
uuid = 1;
} else
error (EXIT_FAILURE, 0,
_("unknown long option: %s (%d)"),
long_options[option_index].name, option_index);
break;
case 'a':
OPTION_a;
break;
case 'c':
OPTION_c;
break;
case 'd':
OPTION_d;
break;
case 'P':
if (sscanf (optarg, "%zu", &max_threads) != 1)
error (EXIT_FAILURE, 0, _("-P option is not numeric"));
break;
case 'q':
quiet = 1;
break;
case 'v':
OPTION_v;
break;
case 'V':
OPTION_V;
break;
case 'x':
OPTION_x;
break;
case HELP_OPTION:
usage (EXIT_SUCCESS);
default:
usage (EXIT_FAILURE);
}
}
/* These are really constants, but they have to be variables for the
* options parsing code. Assert here that they have known-good
* values.
*/
assert (read_only == 1);
assert (inspector == 0);
assert (live == 0);
/* Must be no extra arguments on the command line. */
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
* we assume they belong to a single guest. That's the else-clause
* below.
*/
if (drvs == NULL) {
#if defined(HAVE_LIBVIRT)
get_all_libvirt_domains (libvirt_uri);
r = start_threads (max_threads, g, scan_work);
free_domains ();
if (r == -1)
exit (EXIT_FAILURE);
#else
error (EXIT_FAILURE, 0, _("compiled without support for libvirt"));
#endif
} else { /* Single guest. */
if (uuid)
error (EXIT_FAILURE, 0, _("--uuid option cannot be used with -a or -d"));
/* Add domains/drives from the command line (for a single guest). */
add_drives (drvs);
if (guestfs_launch (g) == -1)
exit (EXIT_FAILURE);
/* Free up data structures, no longer needed after this point. */
free_drives (drvs);
/* Perform the scan. */
r = scan (g, NULL, stdout);
guestfs_close (g);
if (r == -1)
exit (EXIT_FAILURE);
}
/* Decide on an appropriate exit code. */
if (worst_alignment < 10) /* 2^10 = 4096 */
exit_code = 3;
else if (worst_alignment < 16) /* 2^16 = 65536 */
exit_code = 2;
else
exit_code = 0;
exit (exit_code);
}
static int
scan (guestfs_h *g, const char *prefix, FILE *fp)
{
size_t i, j;
size_t alignment;
uint64_t start;
int err;
CLEANUP_FREE_STRING_LIST char **devices = guestfs_list_devices (g);
if (devices == NULL)
return -1;
for (i = 0; devices[i] != NULL; ++i) {
CLEANUP_FREE char *name = NULL;
CLEANUP_FREE_PARTITION_LIST struct guestfs_partition_list *parts = NULL;
guestfs_push_error_handler (g, NULL, NULL);
parts = guestfs_part_list (g, devices[i]);
guestfs_pop_error_handler (g);
if (parts == NULL) {
if (guestfs_last_errno (g) == EINVAL) /* unrecognised disk label */
continue;
else
return -1;
}
/* Canonicalize the name of the device for printing. */
name = guestfs_canonical_device_name (g, devices[i]);
if (name == NULL)
return -1;
for (j = 0; j < parts->len; ++j) {
/* Start offset of the partition in bytes. */
start = parts->val[j].part_start;
if (!quiet) {
if (prefix)
fprintf (fp, "%s:", prefix);
fprintf (fp, "%s%d %12" PRIu64 " ",
name, (int) parts->val[j].part_num, start);
}
/* What's the alignment? */
if (start == 0) /* Probably not possible, but anyway. */
alignment = 64;
else
for (alignment = 0; (start & 1) == 0; alignment++, start /= 2)
;
if (!quiet) {
if (alignment < 10)
fprintf (fp, "%12" PRIu64 " ", UINT64_C(1) << alignment);
else if (alignment < 64)
fprintf (fp, "%12" PRIu64 "K ", UINT64_C(1) << (alignment - 10));
else
fprintf (fp, "- ");
}
err = pthread_mutex_lock (&worst_alignment_mutex);
assert (err == 0);
if (alignment < worst_alignment)
worst_alignment = alignment;
err = pthread_mutex_unlock (&worst_alignment_mutex);
assert (err == 0);
if (alignment < 12) { /* Bad in general: < 4K alignment */
if (!quiet)
fprintf (fp, "bad (%s)\n", _("alignment < 4K"));
} else if (alignment < 16) { /* Bad on NetApps: < 64K alignment */
if (!quiet)
fprintf (fp, "bad (%s)\n", _("alignment < 64K"));
} else {
if (!quiet)
fprintf (fp, "ok\n");
}
}
}
return 0;
}
#if defined(HAVE_LIBVIRT)
/* The multi-threaded version. This callback is called from the code
* in "parallel.c".
*/
static int
scan_work (guestfs_h *g, size_t i, FILE *fp)
{
struct guestfs_add_libvirt_dom_argv optargs;
optargs.bitmask =
GUESTFS_ADD_LIBVIRT_DOM_READONLY_BITMASK |
GUESTFS_ADD_LIBVIRT_DOM_READONLYDISK_BITMASK;
optargs.readonly = 1;
optargs.readonlydisk = "read";
if (guestfs_add_libvirt_dom_argv (g, domains[i].dom, &optargs) == -1)
return -1;
if (guestfs_launch (g) == -1)
return -1;
return scan (g, !uuid ? domains[i].name : domains[i].uuid, fp);
}
#endif /* HAVE_LIBVIRT */

View File

@@ -1,28 +0,0 @@
#!/bin/bash -
# libguestfs
# Copyright (C) 2012 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.
$TEST_FUNCTIONS
skip_if_skipped
$VG virt-alignment-scan --format=raw -a ../test-data/phony-guests/fedora.img
r=$?
# 0, 2 and 3 are reasonable non-error exit codes. Others are errors.
if [ $r -ne 0 -a $r -ne 2 -a $r -ne 3 ]; then
exit $r
fi

View File

@@ -1,399 +0,0 @@
=head1 NAME
virt-alignment-scan - Check alignment of virtual machine partitions
=head1 SYNOPSIS
virt-alignment-scan [--options] -d domname
virt-alignment-scan [--options] -a disk.img [-a disk.img ...]
virt-alignment-scan [--options]
=head1 DESCRIPTION
When older operating systems install themselves, the partitioning
tools place partitions at a sector misaligned with the underlying
storage (commonly the first partition starts on sector C<63>).
Misaligned partitions can result in an operating system issuing more
I/O than should be necessary.
The virt-alignment-scan tool checks the alignment of partitions in
virtual machines and disk images and warns you if there are alignment
problems.
Currently there is no virt tool for fixing alignment problems. You
can only reinstall the guest operating system. The following NetApp
document summarises the problem and possible solutions:
L<http://media.netapp.com/documents/tr-3747.pdf>
=head1 OUTPUT
To run this tool on a disk image directly, use the I<-a> option:
$ virt-alignment-scan -a winxp.img
/dev/sda1 32256 512 bad (alignment < 4K)
$ virt-alignment-scan -a fedora16.img
/dev/sda1 1048576 1024K ok
/dev/sda2 2097152 2048K ok
/dev/sda3 526385152 2048K ok
To run the tool on a guest known to libvirt, use the I<-d> option and
possibly the I<-c> option:
# virt-alignment-scan -d RHEL5
/dev/sda1 32256 512 bad (alignment < 4K)
/dev/sda2 106928640 512 bad (alignment < 4K)
$ virt-alignment-scan -c qemu:///system -d Win7TwoDisks
/dev/sda1 1048576 1024K ok
/dev/sda2 105906176 1024K ok
/dev/sdb1 65536 64K ok
Run virt-alignment-scan without any I<-a> or I<-d> options to scan all
libvirt domains.
# virt-alignment-scan
F16x64:/dev/sda1 1048576 1024K ok
F16x64:/dev/sda2 2097152 2048K ok
F16x64:/dev/sda3 526385152 2048K ok
The output consists of 4 or more whitespace-separated columns. Only
the first 4 columns are significant if you want to parse this from a
program. The columns are:
=over 4
=item col 1
The device and partition name (eg. F</dev/sda1> meaning the
first partition on the first block device).
When listing all libvirt domains (no I<-a> or I<-d> option given) this
column is prefixed by the libvirt name or UUID (if I<--uuid> is
given). eg: C<WinXP:/dev/sda1>
=item col 2
the start of the partition in bytes
=item col 3
the alignment in bytes or Kbytes (eg. C<512> or C<4K>)
=item col 4
C<ok> if the alignment is best for performance, or C<bad> if the
alignment can cause performance problems
=item cols 5+
optional free-text explanation.
=back
The exit code from the program changes depending on whether poorly
aligned partitions were found. See L</EXIT STATUS> below.
If you just want the exit code with no output, use the I<-q> option.
=head1 OPTIONS
=over 4
=item B<--help>
Display brief help.
=item B<-a> file
=item B<--add> file
Add I<file> which should be a disk image from a virtual machine.
The format of the disk image is auto-detected. To override this and
force a particular format use the I<--format=..> option.
=item B<-a URI>
=item B<--add URI>
Add a remote disk. See L<guestfish(1)/ADDING REMOTE STORAGE>.
=item B<-c> URI
=item B<--connect> URI
If using libvirt, connect to the given I<URI>. If omitted, then we
connect to the default libvirt hypervisor.
If you specify guest block devices directly (I<-a>), then libvirt is
not used at all.
=item B<-d> guest
=item B<--domain> guest
Add all the disks from the named libvirt guest. Domain UUIDs can be
used instead of names.
=item B<--format=raw|qcow2|..>
=item B<--format>
The default for the I<-a> option is to auto-detect the format of the
disk image. Using this forces the disk format for I<-a> options which
follow on the command line. Using I<--format> with no argument
switches back to auto-detection for subsequent I<-a> options.
For example:
virt-alignment-scan --format=raw -a disk.img
forces raw format (no auto-detection) for F<disk.img>.
virt-alignment-scan --format=raw -a disk.img --format -a another.img
forces raw format (no auto-detection) for F<disk.img> and reverts to
auto-detection for F<another.img>.
If you have untrusted raw-format guest disk images, you should use
this option to specify the disk format. This avoids a possible
security problem with malicious guests (CVE-2010-3851).
=item B<-P> nr_threads
Since libguestfs 1.22, virt-alignment-scan is multithreaded and
examines guests in parallel. By default the number of threads to use
is chosen based on the amount of free memory available at the time
that virt-alignment-scan is started. You can force
virt-alignment-scan to use at most C<nr_threads> by using the I<-P>
option.
Note that I<-P 0> means to autodetect, and I<-P 1> means to use a
single thread.
=item B<-q>
=item B<--quiet>
Dont produce any output. Just set the exit code
(see L</EXIT STATUS> below).
=item B<--uuid>
Print UUIDs instead of names. This is useful for following a guest
even when the guest is migrated or renamed, or when two guests happen
to have the same name.
This option only applies when listing all libvirt domains (when no
I<-a> or I<-d> options are specified).
=item B<-v>
=item B<--verbose>
Enable verbose messages for debugging.
=item B<-V>
=item B<--version>
Display version number and exit.
=item B<-x>
Enable tracing of libguestfs API calls.
=back
=head1 RECOMMENDED ALIGNMENT
Operating systems older than Windows 2008 and Linux before ca.2010
place the first sector of the first partition at sector 63, with a 512
byte sector size. This happens because of a historical accident.
Drives have to report a cylinder / head / sector (CHS) geometry to the
BIOS. The geometry is completely meaningless on modern drives, but it
happens that the geometry reported always has 63 sectors per track.
The operating system therefore places the first partition at the start
of the second "track", at sector 63.
When the guest OS is virtualized, the host operating system and
hypervisor may prefer accesses aligned to one of:
=over 4
=item * 512 bytes
if the host OS uses local storage directly on hard drive partitions,
and the hard drive has 512 byte physical sectors.
=item * 4 Kbytes
for local storage on new hard drives with 4Kbyte physical sectors; for
file-backed storage on filesystems with 4Kbyte block size; or for some
types of network-attached storage.
=item * 64 Kbytes
for high-end network-attached storage. This is the optimal block size
for some NetApp hardware.
=item * 1 Mbyte
see L</1 MB PARTITION ALIGNMENT> below.
=back
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 │
│ │ │
─ ┴─────────────────────────┴─────────────────────────┴ ─ ─
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
block is written, two host blocks must first be read, the old and new
data combined, and the two blocks written back (4x I/O).
=head2 LINUX HOST BLOCK AND I/O SIZE
New versions of the Linux kernel expose the physical and logical block
size, and minimum and recommended I/O size.
For a typical consumer hard drive with 512 byte sectors:
$ cat /sys/block/sda/queue/hw_sector_size
512
$ cat /sys/block/sda/queue/physical_block_size
512
$ cat /sys/block/sda/queue/logical_block_size
512
$ cat /sys/block/sda/queue/minimum_io_size
512
$ cat /sys/block/sda/queue/optimal_io_size
0
For a new consumer hard drive with 4Kbyte sectors:
$ cat /sys/block/sda/queue/hw_sector_size
4096
$ cat /sys/block/sda/queue/physical_block_size
4096
$ cat /sys/block/sda/queue/logical_block_size
4096
$ cat /sys/block/sda/queue/minimum_io_size
4096
$ cat /sys/block/sda/queue/optimal_io_size
0
For a NetApp LUN:
$ cat /sys/block/sdc/queue/logical_block_size
512
$ cat /sys/block/sdc/queue/physical_block_size
512
$ cat /sys/block/sdc/queue/minimum_io_size
4096
$ cat /sys/block/sdc/queue/optimal_io_size
65536
The NetApp allows 512 byte accesses (but they will be very
inefficient), prefers a minimum 4K I/O size, but the optimal I/O size
is 64K.
For detailed information about what these numbers mean, see
L<http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/newstorage-iolimits.html>
[Thanks to Matt Booth for providing 4K drive data. Thanks to Mike
Snitzer for providing NetApp data and additional information.]
=head2 1 MB PARTITION ALIGNMENT
Microsoft picked 1 MB as the default alignment for all partitions
starting with Windows 2008 Server, and Linux has followed this.
Assuming 512 byte sectors in the guest, you will now see the first
partition starting at sector 2048, and subsequent partitions (if any)
will start at a multiple of 2048 sectors.
1 MB alignment is compatible with all current alignment requirements
(4K, 64K) and provides room for future growth in physical block sizes.
=head2 SETTING ALIGNMENT
L<virt-resize(1)> can change the alignment of the partitions of some
guests. Currently it can fully align all the partitions of all
Windows guests, and it will fix the bootloader where necessary. For
Linux guests, it can align the second and subsequent partitions, so
the majority of OS accesses except at boot will be aligned.
Another way to correct partition alignment problems is to reinstall
your guest operating systems. If you install operating systems from
templates, ensure these have correct partition alignment too.
For older versions of Windows, the following NetApp document contains
useful information: L<http://media.netapp.com/documents/tr-3747.pdf>
For Red Hat Enterprise Linux E<le> 5, use a Kickstart script that
contains an explicit C<%pre> section that creates aligned partitions
using L<parted(8)>. Do not use the Kickstart C<part> command. The
NetApp document above contains an example.
=head1 EXIT STATUS
This program returns:
=over 4
=item *
0
successful exit, all partitions are aligned E<ge> 64K for best performance
=item *
1
an error scanning the disk image or guest
=item *
2
successful exit, some partitions have alignment E<lt> 64K which can result
in poor performance on high end network storage
=item *
3
successful exit, some partitions have alignment E<lt> 4K which can result
in poor performance on most hypervisors
=back
=head1 SEE ALSO
L<guestfs(3)>,
L<guestfish(1)>,
L<virt-filesystems(1)>,
L<virt-rescue(1)>,
L<virt-resize(1)>,
L<http://libguestfs.org/>.
=head1 AUTHOR
Richard W.M. Jones L<http://people.redhat.com/~rjones/>
=head1 COPYRIGHT
Copyright (C) 2011 Red Hat Inc.

View File

@@ -1,5 +1,5 @@
# libguestfs
# Copyright (C) 2009-2019 Red Hat Inc.
# Copyright (C) 2009-2025 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
@@ -32,7 +32,6 @@ include $(top_srcdir)/subdir-rules.mk
EXTRA_DIST = \
99-guestfs-serial.rules \
excludefiles.in \
guestfs_shadow.aug \
hostfiles.in \
init \
libguestfs-make-fixed-appliance.in \
@@ -80,19 +79,52 @@ make.sh: make.sh.in $(top_builddir)/config.log $(top_builddir)/config.status
PACKAGELIST_CPP_FLAGS = -D$(DISTRO)=1 -DEXTRA_PACKAGES="$(EXTRA_PACKAGES)"
packagelist: packagelist.in Makefile
if HAVE_RPM
QUERY_FILES_CMD := xargs rpm -qf --qf '%{name}\n'
else
if HAVE_DPKG
QUERY_FILES_CMD := sed -e 's,^/,\*/,' | xargs dpkg -S | cut -d: -f1
else
if HAVE_PACMAN
QUERY_FILES_CMD := xargs pacman -Qo | sed -r 's/.* is owned by ([^ ]+) .*/\1/'
else
$(error Error: Unknown Linux distribution "$(DISTRO)". Please add support to m4/guestfs-appliance.m4 and appliance/Makefile.am and send a patch upstream to guestfs@lists.libguestfs.org)
endif !HAVE_PACMAN
endif !HAVE_DPKG
endif !HAVE_RPM
# Automatically generate library dependency list
guestfsd.deps: ../daemon/guestfsd
/sbin/ldconfig -p > ld.so.cache.txt
objdump -p $^ |\
sed -ne '/NEEDED/{s/ *NEEDED *//; p;}' |\
xargs -i grep -F {} ld.so.cache.txt |\
sed -ne '/ => /{s/.* => *//; p;}' |\
$(QUERY_FILES_CMD) |\
sort -u > $@.t
rm -f ld.so.cache.txt
mv $@.t $@
@echo "guestfsd.deps:"
@cat $@
packagelist: packagelist.in Makefile guestfsd.deps
m4 $(PACKAGELIST_CPP_FLAGS) $< | \
grep -v '^[[:space:]]*$$' | grep -v '^#' > $@-t
cmp -s $@ $@-t || mv $@-t $@
rm -f $@-t
supermin.d/daemon.tar.gz: ../daemon/guestfsd guestfs_shadow.aug
# Use stable owner/group and mtimes (RHBZ#2320025).
TAR_OPTIONS := \
-z \
--owner=0 --group=0 \
$${SOURCE_DATE_EPOCH:+--mtime=@"$$SOURCE_DATE_EPOCH"}
supermin.d/daemon.tar.gz: ../daemon/guestfsd
rm -f $@ $@-t
rm -rf tmp-d
mkdir -p tmp-d$(DAEMON_SUPERMIN_DIR) tmp-d/etc tmp-d/usr/share/guestfs
mkdir -p tmp-d$(DAEMON_SUPERMIN_DIR) tmp-d/etc
ln ../daemon/guestfsd tmp-d$(DAEMON_SUPERMIN_DIR)/guestfsd
ln $(srcdir)/guestfs_shadow.aug tmp-d/usr/share/guestfs/guestfs_shadow.aug
( cd tmp-d && tar zcf - * ) > $@-t
( cd tmp-d && tar $(TAR_OPTIONS) -cf - * ) > $@-t
rm -r tmp-d
mv $@-t $@
@@ -113,7 +145,7 @@ supermin.d/hostfiles: hostfiles.in Makefile
supermin.d/init.tar.gz: init
rm -f $@ $@-t
( cd $(srcdir) && tar zcf - init ) > $@-t
( cd $(srcdir) && tar $(TAR_OPTIONS) -cf - init ) > $@-t
mv $@-t $@
# We should put this file in /lib/udev/rules.d, but put it in /etc so
@@ -123,7 +155,7 @@ supermin.d/udev-rules.tar.gz: 99-guestfs-serial.rules
rm -rf tmp-u
mkdir -p tmp-u/etc/udev/rules.d
for f in $^; do ln $$f tmp-u/etc/udev/rules.d/$$(basename $$f); done
( cd tmp-u && tar zcf - etc ) > $@-t
( cd tmp-u && tar $(TAR_OPTIONS) -cf - etc ) > $@-t
rm -r tmp-u
mv $@-t $@
@@ -155,5 +187,6 @@ stamp-libguestfs-make-fixed-appliance.pod: libguestfs-make-fixed-appliance.pod
DISTCLEANFILES += \
make.sh \
guestfsd.deps \
packagelist \
supermin.d/*

View File

@@ -1,72 +0,0 @@
(*
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

@@ -5,13 +5,16 @@ dnl
dnl This file is processed by m4 with one of the
dnl following symbols defined (depending on the distro):
dnl
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 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 OPENMANDRIVA=1 For OpenMandriva.
dnl OPENCLOUDOS=1 For OpenCloudOS.
dnl TENCENTOS=1 For TencentOS.
/etc/ld.so.cache
/lib/lsb/*

View File

@@ -17,22 +17,12 @@ if [ ! -d /tmp ] || [ ! -d /var/tmp ]; then
chmod 1777 /tmp /var/tmp
fi
# Try to print a stack trace for segfaults inside the appliance.
for d in /lib64 /lib; do
f=$d/libSegFault.so
if [ -f "$f" ]; then
LD_PRELOAD=$f
export LD_PRELOAD
break
fi
done
mkdir -p /sysroot
# Mount /proc.
if [ ! -d /proc ]; then rm -f /proc; fi
mkdir -p /proc
mkdir -p /proc /sys
mount -t proc /proc /proc
mount -t sysfs /sys /sys
# devtmpfs is required since udev 176
mount -t devtmpfs /dev /dev
ln -s /proc/self/fd /dev/fd
# Parse the kernel command line early (must be after /proc is mounted).
cmdline=$(</proc/cmdline)
@@ -54,31 +44,49 @@ if [[ $cmdline == *guestfs_boot_analysis=1* ]]; then
guestfs_boot_analysis=1
fi
# Mount the other special filesystems.
if [ ! -d /sys ]; then rm -f /sys; fi
mkdir -p /sys
mount -t sysfs /sys /sys
mkdir -p /dev/pts /dev/shm
mount -t devpts /dev/pts /dev/pts
mount -t tmpfs -o mode=1777 shmfs /dev/shm
mkdir -p /sysroot
# On Fedora 42+ fix symlinks in /usr/sbin
# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/PCU2WWLEGLGIOY4TCCBIHLYS6ZCZ4GSS/
# Probably we can remove this eventually.
if test -f /etc/fedora-release &&
test -f /etc/os-release &&
! test -L /usr/sbin ; then
ver="$(sed -n 's/^VERSION_ID=\(.*\)/\1/p' < /etc/os-release)"
if (( $ver >= 42 )); then
for f in /usr/bin/*; do
if test -x "$f"; then
ln -s "$f" /usr/sbin/
fi
done
fi
fi
# taken from initramfs-tools/init --Hilko Bengen
mkdir -p /run
mount -t tmpfs -o "nosuid,size=20%,mode=0755" tmpfs /run
mkdir -p /run/lock
ln -s ../run/lock /var/lock
if [[ $cmdline == *selinux=1* ]]; then
mount -t selinuxfs none /sys/fs/selinux
fi
# On Fedora 23, util-linux creates /etc/mtab in %post .. stupid
# and e2fsprogs fails if the link doesn't exist .. stupid stupid
if ! test -e /etc/mtab; then
ln -s /proc/mounts /etc/mtab
fi
# devtmpfs is required since udev 176
mount -t devtmpfs /dev /dev
mkdir -p /dev/pts
mount -t devpts /dev/pts /dev/pts
mkdir -p /dev/shm
mount -t tmpfs -o mode=1777 shmfs /dev/shm
if [[ $cmdline == *selinux=1* ]]; then
mount -t selinuxfs none /sys/fs/selinux
# For openssl (RHBZ#2133884).
if test -d /etc/crypto-policies/back-ends &&
! test -f /etc/crypto-policies/back-ends/opensslcnf.config &&
test -f /usr/share/crypto-policies/DEFAULT/opensslcnf.txt ; then
ln -sf /usr/share/crypto-policies/DEFAULT/opensslcnf.txt /etc/crypto-policies/back-ends/opensslcnf.config
fi
# Static nodes must happen before udev is started.
@@ -112,8 +120,6 @@ udevadm settle --timeout=600
# Increase the SCSI timeout so we can read remote images.
shopt -s nullglob
for f in /sys/block/sd*/device/timeout; do echo 300 > $f; done
# https://access.redhat.com/site/solutions/5427
for f in /sys/block/{h,s,ub,v}d*/queue/scheduler; do echo noop > $f; done
shopt -u nullglob
# Set up the network.
@@ -121,12 +127,22 @@ ip addr add 127.0.0.1/8 brd + dev lo scope host
ip link set dev lo up
if test "$guestfs_network" = 1; then
iface=$(ls -I all -I default -I lo /proc/sys/net/ipv4/conf)
touch /etc/fstab # Workaround for Ubuntu.
iface=$(ls -I all -I default -I lo -I sit0 /proc/sys/net/ipv4/conf)
# Two workarounds for Ubuntu:
touch /etc/fstab
rm -f /etc/dhcp/dhclient-enter-hooks.d/resolved
# Prevent dhcpcd from failing when /etc/resolv.conf is a dangling symlink.
if [ -L "/etc/resolv.conf" ] && [ ! -e "/etc/resolv.conf" ]; then
rm -f /etc/resolv.conf
fi
if dhclient --version >/dev/null 2>&1; then
dhclient $iface
else
dhcpcd $iface
elif dhcpcd $iface; then
# https://github.com/NetworkConfiguration/dhcpcd/issues/258
for i in `seq 0 10`; do
if grep nameserver /etc/resolv.conf; then break; fi
sleep 1
done
fi
fi
@@ -137,6 +153,17 @@ mdadm -As --auto=yes --no-degraded
# Empty LVM configuration file means "all defaults".
mkdir -p /tmp/lvm
touch /tmp/lvm/lvm.conf
# If lvm2 supports a "devices file", we need to disable its use
# (RHBZ#1965941).
if command -v lvmdevices || command -v vgimportdevices; then
{
printf 'devices {\n'
printf '\tuse_devicesfile = 0\n'
printf '}\n'
} >> /tmp/lvm/lvm.conf
fi
LVM_SYSTEM_DIR=/tmp/lvm
export LVM_SYSTEM_DIR
lvmetad
@@ -157,6 +184,8 @@ if test "$guestfs_verbose" = 1 && test "$guestfs_boot_analysis" != 1; then
ls -lR /dev
cat /proc/mounts
cat /proc/mdstat
lsblk
blkid
lvm config
lvm pvs
lvm vgs

View File

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

View File

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

@@ -4,13 +4,15 @@ dnl
dnl This file is processed by m4 with one of the
dnl following symbols defined (depending on the distro):
dnl
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 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 OPENCLOUDOS=1 For OpencloudOS.
dnl TENCENTOS=1 For TencentOS.
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
@@ -23,47 +25,44 @@ dnl Basically the same with a few minor tweaks.
ifelse(UBUNTU,1,`define(`DEBIAN',1)')
ifelse(REDHAT,1,
augeas-libs
clevis-luks
cryptsetup
cryptsetup-luks dnl old name used before Fedora 17
dhclient
genisoimage
dhcpcd
gfs-utils
gfs2-utils
glibc-gconv-extra dnl syslinux requires IBM850 iconv converter
grub
hfsplus-tools
hivex
iproute
iputils
jansson
kernel
libcap
libldm
libtirpc
nilfs-utils
ntfsprogs
ntfs-3g
ntfs-3g-system-compression
openssh-clients
pcre
policycoreutils
reiserfs-utils
libselinux
rpm-libs
syslinux-extlinux
systemd dnl for /sbin/reboot and udevd
vim-minimal
xz
yara
zfs-fuse
zstd
)
ifelse(DEBIAN,1,
bsdmainutils
dnl old name used in Jessie and earlier
btrfs-tools
clevis-luks
cryptsetup
dash
extlinux
genisoimage
fdisk
dnl gfs-tools, gfs2-tools have been renamed to gfs2-utils
gfs-tools
gfs2-tools
@@ -76,22 +75,16 @@ dnl iproute has been renamed to iproute2
iputils-ping
iputils-arping
iputils-tracepath
dnl isc-dhcp-client has been replaced with dhcpcd-base
isc-dhcp-client
dhcpcd-base
ldmtool
libaugeas0
libc-bin
libcap2
libhivex0
libjansson4
libpcre3
libsystemd0
libsystemd-id128-0
libsystemd-journal0
libtirpc1
libyara3
librpm9
linux-image
dnl syslinux 'suggests' mtools, but in reality it's a hard dependency:
mtools
mount dnl util-linux subpackage containing mount cmd
nilfs-tools
ntfs-3g
openssh-client
@@ -101,75 +94,63 @@ dnl iproute has been renamed to iproute2
ufsutils
vim-tiny
xz-utils
zfs-fuse
zstd
uuid-runtime
)
ifelse(ARCHLINUX,1,
augeas
cdrkit
cdrtools
clevis
cryptsetup
dhclient
dhcpcd
gptfdisk
grub
hivex
iproute2
iputils
jansson
libcap
libtirpc
linux
lrzip
dnl syslinux has mtools as optional dependency, but in reality it's
dnl a hard one:
mtools
multipath-tools dnl for kpartx
nilfs-utils
ntfs-3g
pcre
ntfs-3g-system-compression
reiserfsprogs
systemd
vim
xz
yara
zstd
)
ifelse(SUSE,1,
augeas
dnl It seems no other augeas package depends on it.
augeas-lenses
btrfsprogs
cdrkit-cdrtools-compat
clevis
cryptsetup
dhcpcd
dhcp-client
genisoimage
glibc-locale
gptfdisk
hivex
initviocons
iproute2
iputils
libcap2
libhivex0
libjansson4
libselinux1
libtirpc3
libyara3
mkisofs
ntfsprogs
ntfs-3g
reiserfs
squashfs
sysconfig-netconfig
systemd
systemd-sysvinit
vim
xz
yara
zstd
)
ifelse(FRUGALWARE,1,
augeas
cryptsetup-luks
cdrkit
dhclient
@@ -177,14 +158,10 @@ ifelse(FRUGALWARE,1,
hfsplus
iproute2
iputils
jansson
kernel
libcap
libtirpc
ntfsprogs
ntfs-3g
openssh
pcre
reiserfsprogs
systemd
vim
@@ -195,38 +172,99 @@ ifelse(FRUGALWARE,1,
)
ifelse(MAGEIA,1,
augeas
cryptsetup
chkconfig /* for /etc/init.d */
cdrkit-genisoimage
cdrkit-isotools
dhcp-client
extlinux
gfs2-utils
grub
hfsplus-tools
hivex
iproute2
iputils
libcap
libjansson4
lib64jansson4 /* lib64jansson4 does not provide libjansson4 */
libldm
libtirpc
dnl syslinux uses mtools without depending on it
mtools
nilfs-utils
ntfsprogs
ntfs-3g
ntfs-3g-system-compression
openssh-clients
pcre
reiserfs-utils
libselinux
rpm /* for "supermin: ext2fs_namei: parent directory not found: /var/lib/rpm: File not found by ext2_lookup" */
systemd /* for /sbin/reboot and udevd */
vim-minimal
xz
zstd
)
ifelse(OPENMANDRIVA,1,
cryptsetup
chkconfig /* for /etc/init.d */
dhcp-client
extlinux
grub2
iproute2
iputils
libldm
dnl syslinux uses mtools without depending on it
mtools
nilfs-utils
ntfs-3g
openssh-clients
systemd /* for /sbin/reboot and udevd */
vim-minimal
xz
zstd
)
ifelse(OPENCLOUDOS,1,
clevis-luks
cryptsetup
cryptsetup-luks
dhclient
gfs2-utils
glibc-gconv-extra
hfsplus-tools
iproute
iputils
kernel
ntfsprogs
ntfs-3g
openssh-clients
policycoreutils
rpm-libs
syslinux-extlinux
systemd
vim-minimal
xz
zstd
)
ifelse(TENCENTOS,1,
clevis-luks
cryptsetup
cryptsetup-luks
dhclient
gfs2-utils
glibc-gconv-extra
hfsplus-tools
iproute
iputils
kernel
ntfsprogs
ntfs-3g
openssh-clients
policycoreutils
rpm-libs
syslinux-extlinux
systemd
vim-minimal
xz
zstd
)
include(guestfsd.deps)
acl
attr
bash
@@ -243,6 +281,7 @@ file
findutils
gawk
gdisk
gostsum
grep
gzip
jfsutils
@@ -277,38 +316,10 @@ util-linux-ng
xfsprogs
zerofree
dnl tools needed by virt-dib
ifelse(REDHAT,1,
qemu-img
which
)
ifelse(DEBIAN,1,
qemu-utils
)
ifelse(ARCHLINUX,1,
qemu
which
)
ifelse(SUSE,1,
qemu-tools
which
)
ifelse(FRUGALWARE,1,
qemu
which
)
ifelse(MAGEIA,1,
qemu-img
which
)
curl
kpartx
dnl (virt-dib) tools optionally used for elements
debootstrap
dnl exFAT is not usually available in free software repos
exfat-fuse
exfat-utils
exfatprogs
fuse-exfat
dnl Define this by doing: ./configure --with-extra-packages="..."

View File

@@ -1,51 +0,0 @@
#!/bin/bash -
# libguestfs
# Copyright (C) 2009 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.
#
# Rebuild the autotools environment.
set -e
set -v
# Ensure that whenever we pull in a gnulib update or otherwise change to a
# different version (i.e., when switching branches), we also rerun ./bootstrap.
curr_status=.git-module-status
t=$(git submodule status|sed 's/^[ +-]//;s/ .*//')
if test "$t" = "$(cat $curr_status 2>/dev/null)"; then
: # good, it's up to date
else
echo running bootstrap...
./bootstrap && echo "$t" > $curr_status
fi
CONFIGUREDIR=.
# Run configure in BUILDDIR if it's set
if [ ! -z "$BUILDDIR" ]; then
mkdir -p $BUILDDIR
cd $BUILDDIR
CONFIGUREDIR=..
fi
# If no arguments were specified and configure has run before, use the previous
# arguments
if test $# -eq 0 && test -x ./config.status; then
./config.status --recheck
else
$CONFIGUREDIR/configure "$@"
fi

View File

@@ -1,5 +1,5 @@
# libguestfs
# Copyright (C) 2013-2019 Red Hat Inc.
# Copyright (C) 2013-2025 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,40 +20,16 @@ include $(top_srcdir)/subdir-rules.mk
scripts = \
guestfish \
guestmount \
virt-alignment-scan \
virt-rescue \
virt-v2v \
virt-v2v-copy-to-local
guestunmount \
libguestfs-test-tool \
virt-rescue
# Some of the scripts are simply symbolic links.
symlinks = \
guestunmount \
libguestfs-test-tool \
virt-builder \
virt-cat \
virt-copy-in \
virt-copy-out \
virt-customize \
virt-diff \
virt-df \
virt-dib \
virt-edit \
virt-filesystems \
virt-format \
virt-get-kernel \
virt-inspector \
virt-log \
virt-ls \
virt-p2v-make-disk \
virt-p2v-make-kickstart \
virt-p2v-make-kiwi \
virt-resize \
virt-sparsify \
virt-sysprep \
virt-tail \
virt-tar-in \
virt-tar-out \
virt-win-reg
virt-tar-out
# Note: Don't distribute the symbolic links, only the real files.
EXTRA_DIST = \
@@ -64,27 +40,6 @@ EXTRA_DIST = \
CLEANFILES += \
$(symlinks)
# Any tool that has --short-options and --long-options only is handled
# by this common script.
libguestfs-test-tool virt-win-reg:
rm -f $@
$(LN_S) virt-v2v-copy-to-local $@
# Any tool that has --short-options and --long-options and a few
# common options like -d is handled by this common script. However
# this script cannot deal with commands that use --ro/--rw
# (eg. virt-rescue), nor commands that have lots of exceptions
# (eg. guestfish). Those tools have to be handled individually.
guestunmount \
virt-builder virt-cat virt-customize virt-df virt-dib virt-diff \
virt-edit virt-filesystems virt-format virt-get-kernel virt-inspector \
virt-log virt-ls \
virt-p2v-make-disk virt-p2v-make-kickstart virt-p2v-make-kiwi \
virt-resize virt-sparsify virt-sysprep \
virt-tail:
rm -f $@
$(LN_S) virt-alignment-scan $@
# guestfish is handled specially.
virt-copy-in virt-copy-out virt-tar-in virt-tar-out:
rm -f $@
@@ -102,7 +57,7 @@ all-local: $(scripts) $(symlinks)
install-data-local:
$(mkdir_p) $(DESTDIR)$(bashcompletiondir)
cp -d $(scripts) $(symlinks) $(DESTDIR)$(bashcompletiondir)
cp -P $(scripts) $(symlinks) $(DESTDIR)$(bashcompletiondir)
clean-local:
-test $(srcdir) != $(builddir) && rm -f $(scripts)

View File

@@ -1,5 +1,5 @@
# guestfish bash completion script -*- shell-script -*-
# Copyright (C) 2010-2019 Red Hat Inc.
# Copyright (C) 2010-2025 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 @@
# guestmount bash completion script -*- shell-script -*-
# Copyright (C) 2010-2019 Red Hat Inc.
# Copyright (C) 2010-2025 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-tools bash completion script -*- shell-script -*-
# Copyright (C) 2010-2019 Red Hat Inc.
# Copyright (C) 2010-2025 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
@@ -169,24 +169,6 @@ _virt_ls ()
} &&
complete -o default -F _virt_ls virt-ls
_virt_p2v_make_disk ()
{
_guestfs_virttools "virt-p2v-make-disk" 1
} &&
complete -o default -F _virt_p2v_make_disk virt-p2v-make-disk
_virt_p2v_make_kickstart ()
{
_guestfs_virttools "virt-p2v-make-kickstart" 1
} &&
complete -o default -F _virt_p2v_make_kickstart virt-p2v-make-kickstart
_virt_p2v_make_kiwi ()
{
_guestfs_virttools "virt-p2v-make-kiwi" 1
} &&
complete -o default -F _virt_p2v_make_kiwi virt-p2v-make-kiwi
_virt_resize ()
{
_guestfs_virttools "virt-resize" 0

View File

@@ -1,5 +1,5 @@
# virt-v2v-copy-to-local bash completion script -*- shell-script -*-
# Copyright (C) 2014-2019 Red Hat Inc.
# libguestfs-test-tool bash completion script -*- shell-script -*-
# Copyright (C) 2014-2025 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
@@ -40,12 +40,6 @@ _guestfs_options_only ()
esac
}
_virt_v2v_copy_to_local ()
{
_guestfs_options_only "virt-v2v-copy-to-local"
} &&
complete -o default -F _virt_v2v_copy_to_local virt-v2v-copy-to-local
_virt_win_reg ()
{
_guestfs_options_only "virt-win-reg"

View File

@@ -19,7 +19,10 @@
# Test that the correct 'complete' command is included in the script.
# Mainly prevents symlinking errors and some omissions.
$TEST_FUNCTIONS
source ../tests/functions.sh
set -e
set -x
skip_if_skipped
if [ -z "$commands" ]; then

View File

@@ -1,5 +1,5 @@
# virt-rescue bash completion script -*- shell-script -*-
# Copyright (C) 2010-2019 Red Hat Inc.
# Copyright (C) 2010-2025 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,59 +0,0 @@
# 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

191
bootstrap
View File

@@ -1,191 +0,0 @@
#!/bin/sh
usage() {
echo >&2 "\
Usage: $0 [OPTION]...
Bootstrap this package from the checked-out sources.
Options:
--gnulib-srcdir=DIRNAME specify the local directory where gnulib
sources reside. Use this if you already
have gnulib sources on your machine, and
do not want to waste your bandwidth downloading
them again. Defaults to \$GNULIB_SRCDIR
"
}
for option
do
case $option in
--help)
usage
exit;;
--gnulib-srcdir=*)
GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
*)
echo >&2 "$0: $option: unknown option"
exit 1;;
esac
done
cleanup_gnulib() {
status=$?
rm -fr "$gnulib_path"
exit $status
}
git_modules_config () {
test -f .gitmodules && git config --file .gitmodules "$@"
}
gnulib_path=$(git_modules_config submodule.gnulib.path)
test -z "$gnulib_path" && gnulib_path=gnulib
# Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
# submodule, for use in the rest of the script.
case ${GNULIB_SRCDIR--} in
-)
if git_modules_config submodule.gnulib.url >/dev/null; then
echo "$0: getting gnulib files..."
git submodule init -- "$gnulib_path" || exit $?
git submodule update -- "$gnulib_path" || exit $?
elif [ ! -d "$gnulib_path" ]; then
echo "$0: getting gnulib files..."
trap cleanup_gnulib 1 2 13 15
shallow=
git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" ||
cleanup_gnulib
trap - 1 2 13 15
fi
GNULIB_SRCDIR=$gnulib_path
;;
*)
# Use GNULIB_SRCDIR directly or as a reference.
if test -d "$GNULIB_SRCDIR"/.git && \
git_modules_config submodule.gnulib.url >/dev/null; then
echo "$0: getting gnulib files..."
if git submodule -h|grep -- --reference > /dev/null; then
# Prefer the one-liner available in git 1.6.4 or newer.
git submodule update --init --reference "$GNULIB_SRCDIR" \
"$gnulib_path" || exit $?
else
# This fallback allows at least git 1.5.5.
if test -f "$gnulib_path"/gnulib-tool; then
# Since file already exists, assume submodule init already complete.
git submodule update -- "$gnulib_path" || exit $?
else
# Older git can't clone into an empty directory.
rmdir "$gnulib_path" 2>/dev/null
git clone --reference "$GNULIB_SRCDIR" \
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
&& git submodule init -- "$gnulib_path" \
&& git submodule update -- "$gnulib_path" \
|| exit $?
fi
fi
GNULIB_SRCDIR=$gnulib_path
fi
;;
esac
# Autoreconf runs aclocal before libtoolize, which causes spurious
# warnings if the initial aclocal is confused by the libtoolized
# (or worse out-of-date) macro directory.
libtoolize --copy --install
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
<$gnulib_tool || exit
modules='
accept4
areadlink
areadlinkat
arpa_inet
base64
byteswap
c-ctype
cloexec
closeout
connect
dup3
error
filevercmp
fstatat
fts
full-read
full-write
futimens
getaddrinfo
getline
getprogname
gitlog-to-changelog
glob
gnu-make
gnumakefile
hash
hash-pjw
human
iconv
ignore-value
intprops
lock
maintainer-makefile
manywarnings
memmem
mkdtemp
mkstemps
netdb
netinet_in
nonblocking
openat
perror
pipe2
pread
ptsname_r
read-file
readlink
select
setenv
sleep
socket
stat-time
strchrnul
strerror
strndup
symlinkat
sys_select
sys_types
sys_wait
tls
vasprintf
vc-list-files
warnings
xalloc
xalloc-die
xgetcwd
xstrtol
xstrtoll
xvasprintf
'
# If any tests fail, avoid including them by adding them to
# this list.
avoid="--avoid=dummy --avoid=getlogin_r-tests"
$gnulib_tool \
$avoid \
--with-tests \
--m4-base=m4 \
--source-base=gnulib/lib \
--tests-base=gnulib/tests \
--libtool \
--import $modules
# Disable autopoint and libtoolize, since they were already done above.
AUTOPOINT=true LIBTOOLIZE=true autoreconf --verbose --install

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# bugs-in-changelog.sh
# Copyright (C) 2009-2019 Red Hat Inc.
# Copyright (C) 2009-2025 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,10 +16,10 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Used when preparing the guestfs-release-notes(1) man page. This
# script looks at the bugs noted in the git changelog since the last
# stable release (or any release). To use it, the only parameter
# should be the git commit range, eg:
# Used when preparing the release notes. This script looks at the
# bugs noted in the git changelog since the last stable release (or
# any release). To use it, the only parameter should be the git
# commit range, eg:
#
# ./bugs-in-changelog.sh "1.0.89.."
@@ -30,8 +30,9 @@ fi
# Comma-separated list of Bugzilla IDs.
bugids=$(
git log "$1" | egrep -o 'RHBZ#[0-9]+' |
sed 's/RHBZ#//' |
git log "$1" |
grep -Eio 'RHBZ#[0-9]+|https?://bugzilla.redhat.com/[a-z\.\?/_=]*[0-9]+' |
sed 's/^[^0-9]*//' |
sort -u |
tr '\n' ',' |
sed 's/,$//'
@@ -39,9 +40,16 @@ bugids=$(
#echo bugids "$bugids"
# Filter out any bugs which may still be in NEW or ASSIGNED:
bugzilla query -b "$bugids" \
# Filter out any bugs which may still be in NEW or ASSIGNED.
#
# Ensure user is logged in, otherwise bugzilla will silently truncate
# the number of responses. To log in, see "API KEYS" in bugzilla(1).
bugzilla \
--ensure-logged-in \
query \
-b "$bugids" \
-s MODIFIED,POST,ON_QA,PASSES_QA,VERIFIED,RELEASE_PENDING,CLOSED \
--component libguestfs \
--outputformat='%{bug_id} %{short_desc}' |
sort -n -r |
perl -pe '
@@ -49,3 +57,31 @@ bugzilla query -b "$bugids" \
sprintf ("=item L<https://bugzilla.redhat.com/%s>\n\n%s\n",
$1, $2)
}xe'
# We can't fetch Jira subjects or github issues, but we can at least
# list them.
jiraids=$(
git log "$1" |
grep -Eio 'RHEL-[0-9]{3,}' |
sort -u
)
for id in $jiraids ; do
echo "=item L<https://issues.redhat.com/browse/$id>"
echo
echo "XXX"
echo
done
issues=$(
git log "$1" |
grep -Eio 'https?://github\.com/libguestfs/libguestfs/issues/[0-9]+' |
sort -u
)
for issue in $issues ; do
echo "=item L<$issue>"
echo
echo "XXX"
echo
done

View File

@@ -3,7 +3,7 @@
scriptversion=2013-07-13.22; # UTC
# Copyright (C) 2011-2019 Free Software Foundation, Inc.
# Copyright (C) 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -81,6 +81,11 @@ if test x"$missing_opts" != x; then
usage_error "the following mandatory options are missing:$missing_opts"
fi
# Don't print absolute paths in test output
# Without this, C program tests were printed like
# PASS: /path/to/libguestfs.git/tests/c-api/.libs/test-just-header
test_name=$(echo "$test_name" | sed "s|$(pwd)/||")
if test $# -eq 0; then
usage_error "missing argument"
fi

View File

@@ -1,479 +0,0 @@
# libguestfs virt-builder tool
# Copyright (C) 2013-2019 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.
include $(top_srcdir)/subdir-rules.mk
AM_YFLAGS = -d
EXTRA_DIST = \
$(SOURCES_MLI) $(SOURCES_ML) $(SOURCES_C) \
$(REPOSITORY_SOURCES_ML) \
$(REPOSITORY_SOURCES_MLI) \
index_parser_tests.ml \
libguestfs.gpg \
opensuse.gpg \
test-console.sh \
test-index \
test-simplestreams/streams/v1/index.json \
test-simplestreams/streams/v1/net.cirros-cloud_released_download.json \
test-virt-builder.sh \
test-docs.sh \
test-virt-builder-cacheall.sh \
test-virt-builder-list.sh \
test-virt-builder-list-simplestreams.sh \
test-virt-builder-planner.sh \
test-virt-builder-repository.sh \
test-virt-index-validate.sh \
test-virt-index-validate-bad-1 \
test-virt-index-validate-good-1 \
test-virt-index-validate-good-2 \
test-virt-index-validate-good-3 \
test-virt-index-validate-good-4 \
virt-builder.pod \
virt-builder-repository.pod \
virt-index-validate.pod
SOURCES_MLI = \
builder.mli \
cache.mli \
cmdline.mli \
downloader.mli \
index.mli \
index_parser.mli \
ini_reader.mli \
languages.mli \
list_entries.mli \
osinfo.mli \
osinfo_config.mli \
paths.mli \
pxzcat.mli \
repository_main.mli \
setlocale.mli \
sigchecker.mli \
simplestreams_parser.mli \
sources.mli \
utils.mli
SOURCES_ML = \
utils.ml \
osinfo_config.ml \
osinfo.ml \
pxzcat.ml \
setlocale.ml \
index.ml \
ini_reader.ml \
paths.ml \
languages.ml \
cache.ml \
sources.ml \
downloader.ml \
sigchecker.ml \
index_parser.ml \
simplestreams_parser.ml \
list_entries.ml \
cmdline.ml \
builder.ml
SOURCES_C = \
index-scan.c \
index-struct.c \
index-parse.c \
index-parser-c.c \
pxzcat-c.c \
setlocale-c.c
REPOSITORY_SOURCES_ML = \
utils.ml \
index.ml \
cache.ml \
downloader.ml \
sigchecker.ml \
ini_reader.ml \
index_parser.ml \
paths.ml \
sources.ml \
osinfo_config.ml \
osinfo.ml \
repository_main.ml
REPOSITORY_SOURCES_MLI = \
cache.mli \
downloader.mli \
index.mli \
index_parser.mli \
ini_reader.mli \
sigchecker.mli \
sources.mli
REPOSITORY_SOURCES_C = \
index-scan.c \
index-struct.c \
index-parse.c \
index-parser-c.c
man_MANS =
noinst_DATA =
bin_PROGRAMS =
if HAVE_OCAML
bin_PROGRAMS += virt-builder virt-builder-repository
virt_builder_SOURCES = $(SOURCES_C)
virt_builder_CPPFLAGS = \
-I$(builddir) -I$(srcdir) \
-I$(top_builddir) \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
-I$(shell $(OCAMLC) -where) \
-I$(top_srcdir)/gnulib/lib \
-I$(top_builddir)/common/utils \
-I$(top_srcdir)/common/utils \
-I$(top_srcdir)/lib
virt_builder_CFLAGS = \
-pthread \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
-Wno-unused-macros \
$(LIBLZMA_CFLAGS) \
$(LIBTINFO_CFLAGS) \
$(LIBXML2_CFLAGS)
BOBJECTS = $(SOURCES_ML:.ml=.cmo)
XOBJECTS = $(BOBJECTS:.cmo=.cmx)
virt_builder_repository_SOURCES = $(REPOSITORY_SOURCES_C)
virt_builder_repository_CPPFLAGS = \
-I$(builddir) -I$(srcdir) \
-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)/lib
virt_builder_repository_CFLAGS = \
-pthread \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
-Wno-unused-macros \
$(LIBTINFO_CFLAGS) \
$(LIBXML2_CFLAGS)
REPOSITORY_BOBJECTS = $(REPOSITORY_SOURCES_ML:.ml=.cmo)
REPOSITORY_XOBJECTS = $(REPOSITORY_BOBJECTS:.cmo=.cmx)
# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L
# option to be passed to gcc, so we don't try linking against an
# installed copy of libguestfs.
OCAMLPACKAGES = \
-package str,unix \
-I $(top_builddir)/common/utils/.libs \
-I $(top_builddir)/common/mlxml \
-I $(top_builddir)/lib/.libs \
-I $(top_builddir)/gnulib/lib/.libs \
-I $(top_builddir)/ocaml \
-I $(top_builddir)/common/mlstdutils \
-I $(top_builddir)/common/mlutils \
-I $(top_builddir)/common/mlgettext \
-I $(top_builddir)/common/mlpcre \
-I $(top_builddir)/common/mltools \
-I $(top_builddir)/customize
OCAMLPACKAGES_TESTS =
if HAVE_OCAML_PKG_GETTEXT
OCAMLPACKAGES += -package gettext-stub
endif
if HAVE_OCAML_PKG_OUNIT
OCAMLPACKAGES_TESTS += -package oUnit
endif
OCAMLCLIBS = \
-pthread -lpthread \
-lutils \
$(LIBTINFO_LIBS) \
$(LIBCRYPT_LIBS) \
$(LIBLZMA_LIBS) \
$(LIBXML2_LIBS) \
$(JANSSON_LIBS) \
$(LIBINTL) \
-lgnu
OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) -ccopt '$(CFLAGS)'
if !HAVE_OCAMLOPT
OBJECTS = $(BOBJECTS)
REPOSITORY_OBJECTS = $(REPOSITORY_BOBJECTS)
else
OBJECTS = $(XOBJECTS)
REPOSITORY_OBJECTS = $(REPOSITORY_XOBJECTS)
endif
OCAMLLINKFLAGS = \
mlgettext.$(MLARCHIVE) \
mlpcre.$(MLARCHIVE) \
mlxml.$(MLARCHIVE) \
mlstdutils.$(MLARCHIVE) \
mlguestfs.$(MLARCHIVE) \
mlcutils.$(MLARCHIVE) \
mltools.$(MLARCHIVE) \
customize.$(MLARCHIVE) \
$(LINK_CUSTOM_OCAMLC_ONLY)
virt_builder_DEPENDENCIES = \
$(OBJECTS) \
../common/mlpcre/mlpcre.$(MLARCHIVE) \
../common/mlgettext/mlgettext.$(MLARCHIVE) \
../common/mlstdutils/mlstdutils.$(MLARCHIVE) \
../common/mlutils/mlcutils.$(MLARCHIVE) \
../common/mltools/mltools.$(MLARCHIVE) \
../customize/customize.$(MLARCHIVE) \
$(top_srcdir)/ocaml-link.sh
virt_builder_LINK = \
$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
$(OBJECTS) -o $@
virt_builder_repository_DEPENDENCIES = \
$(REPOSITORY_OBJECTS) \
../common/mltools/mltools.$(MLARCHIVE) \
../common/mlxml/mlxml.$(MLARCHIVE) \
$(top_srcdir)/ocaml-link.sh
virt_builder_repository_LINK = \
$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
$(REPOSITORY_OBJECTS) -o $@
# Manual pages and HTML files for the website.
man_MANS += virt-builder.1
noinst_DATA += $(top_builddir)/website/virt-builder.1.html
virt-builder.1 $(top_builddir)/website/virt-builder.1.html: stamp-virt-builder.pod
stamp-virt-builder.pod: virt-builder.pod $(top_srcdir)/customize/customize-synopsis.pod $(top_srcdir)/customize/customize-options.pod
$(PODWRAPPER) \
--man virt-builder.1 \
--html $(top_builddir)/website/virt-builder.1.html \
--insert $(top_srcdir)/customize/customize-synopsis.pod:__CUSTOMIZE_SYNOPSIS__ \
--insert $(top_srcdir)/customize/customize-options.pod:__CUSTOMIZE_OPTIONS__ \
--license GPLv2+ \
--warning safe \
$<
touch $@
man_MANS += virt-builder-repository.1
noinst_DATA += $(top_builddir)/website/virt-builder-repository.1.html
virt-builder-repository.1 $(top_builddir)/website/virt-builder-repository.1.html: stamp-virt-builder-repository.pod
stamp-virt-builder-repository.pod: virt-builder-repository.pod
$(PODWRAPPER) \
--man virt-builder-repository.1 \
--html $(top_builddir)/website/virt-builder-repository.1.html \
--license GPLv2+ \
--warning safe \
$<
touch $@
# Tests.
TESTS_ENVIRONMENT = $(top_builddir)/run --test
disk_images := \
$(shell for f in debian fedora ubuntu windows; do if [ -s "../test-data/phony-guests/$$f.img" ]; then echo $$f.xz; fi; done) \
$(shell if [ -s "../test-data/phony-guests/fedora.img" ]; then echo fedora.qcow2 fedora.qcow2.xz; fi)
CLEANFILES += *.qcow2 *.xz
check_DATA = $(disk_images)
osinfo_config.ml: Makefile
echo 'let libosinfo_db_path = "$(datadir)/libosinfo/db"' > $@-t
mv $@-t $@
fedora.qcow2: ../test-data/phony-guests/fedora.img
rm -f $@ $@-t
qemu-img convert -f raw -O qcow2 $< $@-t
mv $@-t $@
fedora.qcow2.xz: fedora.qcow2
rm -f $@ $@-t
xz --best -c $< > $@-t
mv $@-t $@
%.xz: ../test-data/phony-guests/%.img
rm -f $@ $@-t
xz --best -c $< > $@-t
mv $@-t $@
index_parser_tests_SOURCES = \
index-scan.c \
index-struct.c \
index-parser-c.c \
index-parse.c
index_parser_tests_CPPFLAGS = $(virt_builder_CPPFLAGS)
index_parser_tests_BOBJECTS = \
utils.cmo \
index.cmo \
cache.cmo \
downloader.cmo \
sigchecker.cmo \
ini_reader.cmo \
index_parser.cmo \
index_parser_tests.cmo
index_parser_tests_XOBJECTS = $(index_parser_tests_BOBJECTS:.cmo=.cmx)
# Can't call the following as <test>_OBJECTS because automake gets confused.
if HAVE_OCAMLOPT
index_parser_tests_THEOBJECTS = $(index_parser_tests_XOBJECTS)
index_parser_tests.cmx: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS)
else
index_parser_tests_THEOBJECTS = $(index_parser_tests_BOBJECTS)
index_parser_tests.cmo: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS)
endif
index_parser_tests_DEPENDENCIES = \
$(index_parser_tests_THEOBJECTS) \
../common/mltools/mltools.$(MLARCHIVE) \
$(top_srcdir)/ocaml-link.sh
index_parser_tests_LINK = \
$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS) $(OCAMLLINKFLAGS) \
$(index_parser_tests_THEOBJECTS) -o $@
TESTS = \
test-docs.sh \
test-virt-builder-cacheall.sh \
test-virt-builder-list.sh \
test-virt-index-validate.sh \
$(SLOW_TESTS)
check_PROGRAMS =
TESTS += test-virt-builder-list-simplestreams.sh
if ENABLE_APPLIANCE
TESTS += test-virt-builder.sh
endif ENABLE_APPLIANCE
if HAVE_OCAML_PKG_OUNIT
check_PROGRAMS += index_parser_tests
TESTS += index_parser_tests
endif
check-valgrind:
$(MAKE) VG="@VG@" check
# Slow tests.
SLOW_TESTS = \
$(console_test_scripts) \
test-virt-builder-planner.sh \
test-virt-builder-repository.sh
check-slow:
$(MAKE) check TESTS="$(SLOW_TESTS)" SLOW=1
# Test that the supplied guests boot with a serial console.
#
# Note that in future we might decide to make the serial console a
# feature, eg. `virt-builder --add-serial-console' or `virt-builder
# --remove-serial-console', so don't assume that having these tests
# means that a serial console is a requirement.
console_test_scripts := \
test-console-centos-7.2.sh \
test-console-rhel-6.8.sh \
test-console-rhel-7.2.sh \
test-console-debian-7.sh \
test-console-debian-8.sh \
test-console-fedora-24.sh \
test-console-ubuntu-12.04.sh \
test-console-ubuntu-14.04.sh \
test-console-ubuntu-16.04.sh \
test-console-ubuntu-18.04.sh
test-console-%.sh:
rm -f $@ $@-t
f=`echo "$@" | $(SED) 's/test-console-\(.*\).sh/\1/'`; \
echo 'script=$@ exec $$srcdir/test-console.sh' "$$f" > $@-t
chmod 0755 $@-t
mv $@-t $@
CLEANFILES += \
$(console_test_scripts) \
console-*.img \
console-*.out
# OCaml dependencies.
.depend: $(srcdir)/*.mli $(srcdir)/*.ml osinfo_config.mli osinfo_config.ml
$(top_builddir)/ocaml-dep.sh $^
-include .depend
endif
.PHONY: docs
# virt-builder's default repository
repoconfdir = $(sysconfdir)/xdg/virt-builder/repos.d
repoconf_DATA = libguestfs.conf libguestfs.gpg \
opensuse.conf opensuse.gpg
install-exec-hook:
$(LN_S) -f xdg/virt-builder $(DESTDIR)$(sysconfdir)/virt-builder
# Build a small C index validator program.
bin_PROGRAMS += virt-index-validate
virt_index_validate_SOURCES = \
index-parse.y \
index-scan.l \
index-struct.h \
index-struct.c \
index-validate.c
virt_index_validate_CPPFLAGS = \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I. \
-I$(top_builddir) \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
-I$(top_srcdir)/common/utils \
-I$(top_srcdir)/lib
virt_index_validate_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
-Wno-unused-macros
virt_index_validate_LDADD = \
$(LTLIBINTL) \
../gnulib/lib/libgnu.la
man_MANS += virt-index-validate.1
noinst_DATA += $(top_builddir)/website/virt-index-validate.1.html
virt-index-validate.1 $(top_builddir)/website/virt-index-validate.1.html: stamp-virt-index-validate.pod
stamp-virt-index-validate.pod: virt-index-validate.pod
$(PODWRAPPER) \
--man virt-index-validate.1 \
--html $(top_builddir)/website/virt-index-validate.1.html \
--license GPLv2+ \
--warning safe \
$<
touch $@
CLEANFILES += \
index-parse.c \
index-parse.h \
index-scan.c
BUILT_SOURCES = index-parse.h
# Apparently there's no clean way with Automake to not have them
# in the distribution, so just remove them from the distdir.
dist-hook:
rm -f $(distdir)/index-parse.c $(distdir)/index-parse.h $(distdir)/index-scan.c

View File

@@ -1,794 +0,0 @@
(* virt-builder
* Copyright (C) 2013-2019 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
open Common_gettext.Gettext
module G = Guestfs
open Std_utils
open Tools_utils
open Unix_utils
open Password
open Planner
open Utils
open Cmdline
open Customize_cmdline
open Unix
open Printf
let () = Random.self_init ()
let remove_duplicates index =
let compare_revisions rev1 rev2 =
match rev1, rev2 with
| Rev_int n1, Rev_int n2 -> compare n1 n2
| Rev_string s1, Rev_int n2 -> compare s1 (string_of_int n2)
| Rev_int n1, Rev_string s2 -> compare (string_of_int n1) s2
| Rev_string s1, Rev_string s2 -> compare s1 s2
in
(* Fill an hash with the higher revision of the available
* (name, arch) tuples, so it possible to ignore duplicates,
* and versions with a lower revision.
*)
let nseen = Hashtbl.create 13 in
List.iter (
fun (name, { Index.arch; revision }) ->
let id = name, arch in
try
let rev = Hashtbl.find nseen id in
if compare_revisions rev revision > 0 then
Hashtbl.replace nseen id revision
with Not_found ->
Hashtbl.add nseen id revision
) index;
List.filter (
fun (name, { Index.arch ; revision }) ->
let id = name, arch in
try
let rev = Hashtbl.find nseen (name, arch) in
(* Take the first occurrency with the higher revision,
* removing it from the hash so the other occurrencies
* are ignored.
*)
if revision = rev then (
Hashtbl.remove nseen id;
true
) else
false
with Not_found ->
(* Already taken, so ignore. *)
false
) index
(* Look for the specified os-version, resolving it as alias first. *)
let selected_cli_item cmdline index =
let arg =
(* Try to resolve the alias. *)
try
let item =
List.find (
fun (name, { Index.aliases }) ->
match aliases with
| None -> false
| Some l -> List.mem cmdline.arg l
) index in
fst item
with Not_found -> cmdline.arg in
let item =
try List.find (
fun (name, { Index.arch = a }) ->
name = arg && cmdline.arch = normalize_arch (Index.string_of_arch a)
) index
with Not_found ->
error (f_"cannot find os-version %s with architecture %s.\nUse --list to list available guest types.")
arg cmdline.arch in
item
let main () =
(* Command line argument parsing - see cmdline.ml. *)
let cmdline = parse_cmdline () in
(* If debugging, echo the command line arguments and the sources. *)
if verbose () then (
printf "command line:";
List.iter (printf " %s") (Array.to_list Sys.argv);
print_newline ();
List.iteri (
fun i (source, fingerprint) ->
printf "source[%d] = (%S, %S)\n" i source fingerprint
) cmdline.sources
);
(* Handle some modes here, some later on. *)
let mode =
match cmdline.mode with
| `Get_kernel -> (* --get-kernel is really a different program ... *)
let cmd = [ "virt-get-kernel" ] @
(if verbose () then [ "--verbose" ] else []) @
(if trace () then [ "-x" ] else []) @
(match cmdline.format with
| None -> []
| Some format -> [ "--format"; format ]) @
(match cmdline.output with
| None -> []
| Some output -> [ "--output"; output ]) @
[ "--add"; cmdline.arg ] in
exit (run_command cmd)
| `Delete_cache -> (* --delete-cache *)
(match cmdline.cache with
| Some cachedir ->
message (f_"Deleting: %s") cachedir;
Cache.clean_cachedir cachedir;
exit 0
| None ->
error (f_"could not find cache directory. Is $HOME set?")
)
| (`Install|`List|`Notes|`Print_cache|`Cache_all) as mode -> mode in
(* Check various programs/dependencies are installed. *)
(* Check that gpg is installed. Optional as long as the user
* disables all signature checks.
*)
if cmdline.check_signature then (
let cmd = sprintf "%s --help >/dev/null 2>&1" cmdline.gpg in
if cmdline.gpg = "" || shell_command cmd <> 0 then
error (f_"no GNU Privacy Guard (GnuPG, gpg) binary was found.\n\nEither gpg v1 or v2 can be installed to check signatures. Virt-builder looks for a binary called either gpg2 or gpg on the $PATH. You can also specify a binary using the --gpg option. If you don't want to check signatures, use --no-check-signature but note that this may make you vulnerable to Man-In-The-Middle attacks.")
);
(* Check that curl works. *)
let cmd = sprintf "%s --help >/dev/null 2>&1" cmdline.curl in
if shell_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 shell_command cmd <> 0 then
error (f_"virt-resize is not installed (or does not work)");
(* Create the cache. *)
let cache =
match cmdline.cache with
| None -> None
| Some dir ->
try Some (Cache.create ~directory:dir)
with exn ->
warning (f_"cache %s: %s") dir (Printexc.to_string exn);
warning (f_"disabling the cache");
None
in
(* Create a single temporary directory for all the small-or-so
* temporary files that Downloader, Sigchecker, etc, are going
* create.
*)
let tmpdir = Mkdtemp.temp_dir "virt-builder." in
rmdir_on_exit tmpdir;
(* Download the sources. *)
let downloader = Downloader.create ~curl:cmdline.curl ~cache ~tmpdir in
let repos = Sources.read_sources () in
let sources = List.map (
fun (source, fingerprint) ->
{
Sources.name = source; uri = source;
gpgkey = Utils.Fingerprint fingerprint;
proxy = Curl.SystemProxy;
format = Sources.FormatNative;
}
) cmdline.sources in
let sources = List.append sources repos in
let index : Index.index =
List.concat (
List.map (
fun source ->
let sigchecker =
Sigchecker.create ~gpg:cmdline.gpg
~check_signature:cmdline.check_signature
~gpgkey:source.Sources.gpgkey
~tmpdir in
match source.Sources.format with
| Sources.FormatNative ->
Index_parser.get_index ~downloader ~sigchecker source
| Sources.FormatSimpleStreams ->
Simplestreams_parser.get_index ~downloader ~sigchecker source
) sources
) in
let index = remove_duplicates index in
(* Now handle the remaining modes. *)
let mode =
match mode with
| `List -> (* --list *)
let sources, index =
match cmdline.arg with
| "" -> sources, index (* no template -> all the available ones *)
| arg -> (* just the specified template *)
let item = selected_cli_item cmdline index in
[], [item] in
List_entries.list_entries ~list_format:cmdline.list_format ~sources index;
exit 0
| `Print_cache -> (* --print-cache *)
(match cache with
| Some cache ->
let l = List.filter (
fun (_, { Index.hidden }) ->
hidden <> true
) index in
let l = List.map (
fun (name, { Index.revision; arch }) ->
(name, arch, revision)
) l in
Cache.print_item_status cache ~header:true l
| None -> printf (f_"no cache directory\n")
);
exit 0
| `Cache_all -> (* --cache-all-templates *)
(match cache with
| None ->
error (f_"no cache directory")
| Some _ ->
List.iter (
fun (name,
{ Index.revision; file_uri; proxy; arch }) ->
let template = name, arch, revision in
message (f_"Downloading: %s") file_uri;
let progress_bar = not (quiet ()) in
ignore (Downloader.download downloader ~template ~progress_bar
~proxy file_uri)
) index;
exit 0
);
| (`Install|`Notes) as mode -> mode in
(* Which os-version (ie. index entry)? *)
let item = selected_cli_item cmdline index in
let arg = fst item in
let entry = snd item in
let sigchecker = entry.Index.sigchecker in
(match mode with
| `Notes -> (* --notes *)
let notes =
Languages.find_notes (Languages.languages ()) entry.Index.notes in
(match notes with
| notes :: _ ->
print_endline notes
| [] ->
printf (f_"There are no notes for %s\n") arg
);
exit 0
| `Install ->
() (* fall through to create the guest *)
);
(* --- If we get here, we want to create a guest. --- *)
(* Warn if the user might be writing to a partition on a USB key. *)
(match cmdline.output with
| Some device when is_partition device ->
if cmdline.warn_if_partition then
warning (f_"output device (%s) is a partition. If you are writing to a USB key or external drive then you probably need to write to the whole device, not to a partition. If this warning is wrong then you can disable it with --no-warn-if-partition")
device;
| Some _ | None -> ()
);
(* Download the template, or it may be in the cache. *)
let template =
let template, delete_on_exit =
let { Index.revision; file_uri; proxy } = entry in
let template = arg, Index.Arch cmdline.arch, revision in
message (f_"Downloading: %s") file_uri;
let progress_bar = not (quiet ()) in
Downloader.download downloader ~template ~progress_bar ~proxy
file_uri in
if delete_on_exit then unlink_on_exit template;
template in
(* Check the signature of the file. *)
let () =
match entry with
(* New-style: Using a checksum. *)
| { Index.checksums = Some csums } ->
(match Checksums.verify_checksums csums template with
| Checksums.Good_checksum -> ()
| Checksums.Mismatched_checksum (csum, csum_actual) ->
error (f_"%s checksum of template did not match the expected checksum!\n found checksum: %s\n expected checksum: %s\nTry:\n - Use the -v option and look for earlier error messages.\n - Delete the cache: virt-builder --delete-cache\n - Check no one has tampered with the website or your network!")
(Checksums.string_of_csum_t csum) csum_actual (Checksums.string_of_csum csum)
| Checksums.Missing_file ->
error (f_"%s: template not downloaded or deleted. You may have run virt-builder --delete-cache in parallel.")
template
)
| { Index.checksums = None } ->
(* Old-style: detached signature. *)
let sigfile =
match entry with
| { Index.signature_uri = None } -> None
| { Index.signature_uri = Some signature_uri } ->
let sigfile, delete_on_exit =
Downloader.download downloader signature_uri in
if delete_on_exit then unlink_on_exit sigfile;
Some sigfile in
Sigchecker.verify_detached sigchecker template sigfile in
(* For an explanation of the Planner, see:
* http://rwmj.wordpress.com/2013/12/14/writing-a-planner-to-solve-a-tricky-programming-optimization-problem/
*)
(* Planner: Input tags. *)
let itags =
let { Index.size; format } = entry in
let format_tag =
match format with
| None -> []
| Some format -> [`Format, format] in
let compression_tag =
match detect_file_type template with
| `XZ -> [ `XZ, "" ]
| `GZip | `Tar | `Zip ->
error (f_"input file (%s) has an unsupported type") template
| `Unknown -> [] in
[ `Template, ""; `Filename, template; `Size, Int64.to_string size ] @
format_tag @ compression_tag in
(* Planner: Goal. *)
let output_filename, output_format =
match cmdline.output, cmdline.format with
| None, None -> sprintf "%s.img" arg, "raw"
| None, Some "raw" -> sprintf "%s.img" arg, "raw"
| None, Some format -> sprintf "%s.%s" arg format, format
| Some output, None -> output, "raw"
| Some output, Some format -> output, format in
if is_char_device output_filename then
error (f_"cannot output to a character device or /dev/null");
let blockdev_getsize64 dev =
let cmd = sprintf "blockdev --getsize64 %s" (quote dev) in
let lines = external_command cmd in
assert (List.length lines >= 1);
Int64.of_string (List.hd lines)
in
let output_is_block_dev, blockdev_size =
let b = is_block_device output_filename in
let sz = if b then blockdev_getsize64 output_filename else 0L in
b, sz in
let output_size =
let { Index.size = original_image_size } = entry in
let size =
match cmdline.size with
| Some size -> size
(* --size parameter missing, output to file: use original image size *)
| None when not output_is_block_dev -> original_image_size
(* --size parameter missing, block device: use block device size *)
| None -> blockdev_size in
if size < original_image_size then
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
(* Goal: must *)
let must = [
`Filename, output_filename;
`Size, Int64.to_string output_size;
`Format, output_format
] in
(* Goal: must not *)
let must_not = [ `Template, ""; `XZ, "" ] in
let cache_dir = (open_guestfs ())#get_cachedir () in
(* Planner: Transitions. *)
let transitions itags =
let is t = List.mem_assoc t itags in
let is_not t = not (is t) in
let remove = List.remove_assoc in
let ret = ref [] in
let infile = List.assoc `Filename itags in
(* The scheme for weights ranges from 0 = free to 100 = most expensive:
*
* 0 = free operations like renaming a file in the same directory
* 10 = in-place conversions (like [qemu-img resize])
* 20 = copy or move a file between two local filesystems
* 30 = copy and convert a file between two local filesystems
* 40 = copy a file within the same local filesystem
* 50 = copy and convert a file within the same local filesystem
* 80 = copy, move, convert if source or target is on network filesystem
* 100 = complex operations like virt-resize
*
* Copies and moves across different local filesystems are
* cheaper than copies within the same filesystem. The
* theory because less bandwith is available if both source
* and destination hit the same device (except in the special
* case of moving within a filesystem which is free).
*
* We could estimate weights better by looking at file sizes.
*)
let weight task otags =
let outfile = List.assoc `Filename otags in
(* If infile/outfile don't exist, get the containing directory. *)
let infile =
if Sys.file_exists infile then infile else Filename.dirname infile in
let outfile =
if Sys.file_exists outfile then outfile else Filename.dirname outfile in
match task with
| `Virt_resize -> 100 (* virt-resize is a special case*)
| (`Copy|`Move|`Pxzcat|`Disk_resize|`Convert) as task ->
if StatVFS.is_network_filesystem infile ||
StatVFS.is_network_filesystem outfile
then 80 (* NFS etc. *)
else (
let across = (lstat infile).st_dev <> (lstat outfile).st_dev in
match task, across with
| `Move, false -> 0 (* rename in same filesystem *)
| `Disk_resize, _ -> 10 (* in-place conversion *)
| `Move, true (* move or copy between two filesystems *)
| `Copy, true -> 20
| (`Pxzcat|`Convert), true -> 30 (* convert between two local fses*)
| `Copy, false -> 40 (* copy within same filesystem *)
| (`Pxzcat|`Convert), false -> 50 (* convert with same local fs*)
)
in
(* Add a transition to the returned list. *)
let tr task otags = List.push_front (task, weight task otags, otags) ret in
(* Since the final plan won't run in parallel, we don't only need
* to choose unique tempfiles per transition, so this is OK:
*)
let tempfile = Filename.temp_file ~temp_dir:cache_dir "vb" ".img" in
unlink_on_exit tempfile;
(* Always possible to copy from one place to another. The only
* thing a copy does is to remove the template tag (since it's always
* copied out of the cache directory).
*)
if infile <> output_filename then
tr `Copy ((`Filename, output_filename) :: remove `Template itags);
tr `Copy ((`Filename, tempfile) :: remove `Template itags);
(* We can rename a file instead of copying, but don't rename the
* cache copy!
*)
if is_not `Template then (
if not output_is_block_dev && infile <> output_filename then
tr `Move ((`Filename, output_filename) :: itags);
tr `Move ((`Filename, tempfile) :: itags)
);
if is `XZ then (
(* If the input is XZ-compressed, then we can run xzcat, either
* to the output file or to a temp file.
*)
if not output_is_block_dev && infile <> output_filename then
tr `Pxzcat
((`Filename, output_filename) :: remove `XZ (remove `Template itags));
tr `Pxzcat
((`Filename, tempfile) :: remove `XZ (remove `Template itags));
)
else (
(* If the input is NOT compressed then we could run virt-resize
* if it makes sense to resize the image. Note that virt-resize
* can do both size and format conversions.
*)
let old_size = Int64.of_string (List.assoc `Size itags) in
let headroom = 256L *^ 1024L *^ 1024L in
if output_size >= old_size +^ headroom then (
if infile <> output_filename then
tr `Virt_resize
((`Size, Int64.to_string output_size) ::
(`Filename, output_filename) ::
(`Format, output_format) :: (remove `Template itags));
tr `Virt_resize
((`Size, Int64.to_string output_size) ::
(`Filename, tempfile) ::
(`Format, output_format) :: (remove `Template itags))
)
(* If the size increase is smaller than the amount of headroom
* inside the disk image, then virt-resize won't work. However
* we can do a disk resize (using 'qemu-img resize') instead,
* although it won't resize the filesystems for the user.
*
* 'qemu-img resize' works on the file in-place and won't change
* the format. It must not be run on a template directly.
*
* Don't run 'qemu-img resize' on an auto format. This is to
* force an explicit conversion step to a real format.
*)
else if output_size > old_size && is_not `Template
&& List.mem_assoc `Format itags then
tr `Disk_resize ((`Size, Int64.to_string output_size) :: itags);
(* qemu-img convert is always possible, and quicker. It doesn't
* resize, but it does change the format.
*)
if infile <> output_filename then
tr `Convert
((`Filename, output_filename) :: (`Format, output_format) ::
(remove `Template itags));
tr `Convert
((`Filename, tempfile) :: (`Format, output_format) ::
(remove `Template itags));
);
(* Return the list of possible transitions. *)
!ret
in
(* Plan how to create the disk image. *)
message (f_"Planning how to build this image");
let plan =
match plan ~max_depth:5 transitions itags ~must ~must_not with
| Some plan -> plan
| None ->
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 printf " +filename=%s" v
with Not_found -> ());
(try
let v = List.assoc `Size tags in printf " +size=%s" v
with Not_found -> ());
(try
let v = List.assoc `Format tags in printf " +format=%s" v
with Not_found -> ());
if List.mem_assoc `Template tags then printf " +template";
if List.mem_assoc `XZ tags then printf " +xz"
in
let print_task = function
| `Copy -> printf "cp"
| `Move -> printf "mv"
| `Pxzcat -> printf "pxzcat"
| `Virt_resize -> printf "virt-resize"
| `Disk_resize -> printf "qemu-img resize"
| `Convert -> printf "qemu-img convert"
in
List.iteri (
fun i (itags, task, otags) ->
printf "%d: itags:" i;
print_tags itags;
printf "\n";
printf "%d: task : " i;
print_task task;
printf "\n";
printf "%d: otags:" i;
print_tags otags;
printf "\n\n%!"
) plan
);
(* Delete the output file before we finish. However don't delete it
* if it's block device, or if --no-delete-on-failure is set.
*)
let delete_output_file =
ref (cmdline.delete_on_failure && not output_is_block_dev) in
let delete_file () =
if !delete_output_file then
try unlink output_filename with _ -> ()
in
at_exit delete_file;
(* Carry out the plan. *)
List.iter (
function
| itags, `Copy, otags ->
let ifile = List.assoc `Filename itags in
let ofile = List.assoc `Filename otags in
message (f_"Copying");
let cmd = [ "cp"; ifile; ofile ] in
if run_command cmd <> 0 then exit 1
| itags, `Move, otags ->
let ifile = List.assoc `Filename itags in
let ofile = List.assoc `Filename otags in
let cmd = [ "mv"; ifile; ofile ] in
if run_command cmd <> 0 then exit 1
| itags, `Pxzcat, otags ->
let ifile = List.assoc `Filename itags in
let ofile = List.assoc `Filename otags in
message (f_"Uncompressing");
Pxzcat.pxzcat ifile ofile
| itags, `Virt_resize, otags ->
let ifile = List.assoc `Filename itags in
let iformat =
try Some (List.assoc `Format itags) with Not_found -> None in
let ofile = List.assoc `Filename otags in
let osize = Int64.of_string (List.assoc `Size otags) in
let osize = roundup64 osize 512L in
let oformat = List.assoc `Format otags in
let { Index.expand; lvexpand } = entry in
message (f_"Resizing (using virt-resize) to expand the disk to %s")
(human_size osize);
let preallocation = if oformat = "qcow2" then Some "metadata" else None in
let () =
let g = open_guestfs () in
g#disk_create ?preallocation ofile oformat osize in
let cmd = [ "virt-resize" ] @
(if verbose () then [ "--verbose" ] else [ "--quiet" ]) @
(if is_block_device ofile then [ "--no-sparse" ] else []) @
(match iformat with
| None -> []
| Some iformat -> [ "--format"; iformat ]) @
[ "--output-format"; oformat ] @
(match expand with
| None -> []
| Some expand -> [ "--expand"; expand ]) @
(match lvexpand with
| None -> []
| Some lvexpand -> [ "--lv-expand"; lvexpand ]) @
[ "--unknown-filesystems"; "error"; ifile; ofile ] in
if run_command cmd <> 0 then exit 1
| itags, `Disk_resize, otags ->
let ofile = List.assoc `Filename otags in
let osize = Int64.of_string (List.assoc `Size otags) in
let osize = roundup64 osize 512L in
message (f_"Resizing container (but not filesystems) to expand the disk to %s")
(human_size osize);
let cmd = sprintf "qemu-img resize %s %Ld%s"
(quote ofile) osize (if verbose () then "" else " >/dev/null") in
if shell_command cmd <> 0 then exit 1
| itags, `Convert, otags ->
let ifile = List.assoc `Filename itags in
let iformat =
try Some (List.assoc `Format itags) with Not_found -> None in
let ofile = List.assoc `Filename otags in
let oformat = List.assoc `Format otags in
(match iformat with
| None -> message (f_"Converting to %s") oformat
| Some f -> message (f_"Converting %s to %s") f oformat
);
let cmd = sprintf "qemu-img convert%s %s -O %s %s%s"
(match iformat with
| None -> ""
| Some iformat -> sprintf " -f %s" (quote iformat))
(quote ifile) (quote oformat) (quote (qemu_input_filename ofile))
(if verbose () then "" else " >/dev/null 2>&1") in
if shell_command cmd <> 0 then exit 1
) plan;
(* Now mount the output disk so we can make changes. *)
message (f_"Opening the new disk");
let g =
let g = open_guestfs () in
Option.may g#set_memsize cmdline.memsize;
Option.may g#set_smp cmdline.smp;
g#set_network cmdline.network;
(* The output disk is being created, so use cache=unsafe here. *)
g#add_drive_opts ~format:output_format ~cachemode:"unsafe" output_filename;
(* Attach ISOs, if we have any. *)
List.iter (
fun (format, file) ->
g#add_drive_opts ?format ~readonly:true file;
) cmdline.attach;
g#launch ();
g in
(* Inspect the disk and mount it up. *)
let root =
match Array.to_list (g#inspect_os ()) with
| [root] ->
inspect_mount_root g root;
root
| _ ->
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 g root cmdline.customize_ops;
(* Collect some stats about the final output file.
* Notes:
* - These are virtual disk stats.
* - Never fail here.
*)
let stats =
if not (quiet ()) then (
try
(* Calculate the free space (in bytes) across all mounted
* filesystems in the guest.
*)
let free_bytes, total_bytes =
let filesystems = List.map snd (g#mountpoints ()) in
let stats = List.map g#statvfs filesystems in
let stats = List.map (
fun { G.bfree; bsize; blocks } ->
bfree *^ bsize, blocks *^ bsize
) stats in
List.fold_left (
fun (f,t) (f',t') -> f +^ f', t +^ t'
) (0L, 0L) stats in
let free_percent = 100L *^ free_bytes /^ total_bytes in
Some (
String.concat "\n" [
sprintf "%30s: %s" (s_"Output file") output_filename;
sprintf "%30s: %s" (s_"Output size") (human_size output_size);
sprintf "%30s: %s" (s_"Output format") output_format;
sprintf "%30s: %s" (s_"Total usable space")
(human_size total_bytes);
sprintf "%30s: %s (%Ld%%)" (s_"Free space")
(human_size free_bytes) free_percent;
] ^ "\n"
)
with
_ -> None
)
else None in
(* Unmount everything and we're done! *)
message (f_"Finishing off");
g#umount_all ();
g#shutdown ();
g#close ();
(* Because we used cache=unsafe when writing the output file, the
* file might not be committed to disk. This is a problem if qemu is
* immediately used afterwards with cache=none (which uses O_DIRECT
* and therefore bypasses the host cache). In general you should not
* use cache=none.
*)
if cmdline.sync then
Fsync.file output_filename;
(* Now that we've finished the build, don't delete the output file on
* exit.
*)
delete_output_file := false;
(* Print the stats calculated above. *)
Pervasives.flush Pervasives.stdout;
Pervasives.flush Pervasives.stderr;
Option.may print_string stats
let () = run_main_and_handle_errors main

View File

@@ -1,19 +0,0 @@
(* virt-builder
* Copyright (C) 2017 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.
*)
(* Nothing is exported. *)

View File

@@ -1,61 +0,0 @@
(* virt-builder
* Copyright (C) 2013-2019 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
open Std_utils
open Tools_utils
open Common_gettext.Gettext
open Utils
open Unix
open Printf
let clean_cachedir dir =
let cmd = [ "rm"; "-rf"; dir ] in
ignore (run_command cmd);
type t = {
directory : string;
}
let create ~directory =
if not (is_directory directory) then
mkdir_p directory 0o755;
{
directory = directory;
}
let cache_of_name t name arch revision =
t.directory // sprintf "%s.%s.%s" name
(Index.string_of_arch arch)
(string_of_revision revision)
let is_cached t name arch revision =
let filename = cache_of_name t name arch revision in
Sys.file_exists filename
let print_item_status t ~header l =
if header then (
printf (f_"cache directory: %s\n") t.directory
);
List.iter (
fun (name, arch, revision) ->
let cached = is_cached t name arch revision in
printf "%-24s %-10s %s\n" name (Index.string_of_arch arch)
(if cached then s_"cached" else (*s_*)"no")
) l

View File

@@ -1,45 +0,0 @@
(* virt-builder
* Copyright (C) 2013-2019 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
(** This module represents a local cache. *)
val clean_cachedir : string -> unit
(** [clean_cachedir dir] clean the specified cache directory. *)
type t
(** The abstract data type. *)
val create : directory:string -> t
(** Create the abstract type. *)
val cache_of_name : t -> string -> Index.arch -> Utils.revision -> string
(** [cache_of_name t name arch revision] return the filename
of the cached file. (Note: It doesn't check if the filename
exists, this is just a simple string transformation). *)
val is_cached : t -> string -> Index.arch -> Utils.revision -> bool
(** [is_cached t name arch revision] return whether the file with
specified name, architecture and revision is cached. *)
val print_item_status : t -> header:bool -> (string * Index.arch * Utils.revision) list -> unit
(** [print_item_status t header items] print the status in the cache
of the specified items (which are tuples of name, architecture,
and revision).
If [~header:true] then display a header with the path of the
cache. *)

View File

@@ -1,334 +0,0 @@
(* virt-builder
* Copyright (C) 2013-2019 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
(* Command line argument parsing. *)
open Std_utils
open Tools_utils
open Common_gettext.Gettext
open Getopt.OptionName
open Customize_cmdline
open Utils
module G = Guestfs
open Unix
open Printf
type cmdline = {
mode : [ `Cache_all | `Delete_cache | `Get_kernel | `Install | `List
| `Notes | `Print_cache ];
arg : string;
arch : string;
attach : (string option * string) list;
cache : string option;
check_signature : bool;
curl : string;
customize_ops : Customize_cmdline.ops;
delete_on_failure : bool;
format : string option;
gpg : string;
list_format : List_entries.format;
memsize : int option;
network : bool;
output : string option;
size : int64 option;
smp : int option;
sources : (string * string) list;
sync : bool;
warn_if_partition : bool;
}
let parse_cmdline () =
let mode = ref `Install in
let list_mode () = mode := `List in
let notes_mode () = mode := `Notes in
let get_kernel_mode () = mode := `Get_kernel in
let cache_all_mode () = mode := `Cache_all in
let print_cache_mode () = mode := `Print_cache in
let delete_cache_mode () = mode := `Delete_cache in
let arch = ref "" in
let attach = ref [] in
let attach_format = ref None in
let set_attach_format = function
| "auto" -> attach_format := None
| s -> attach_format := Some s
in
let attach_disk s = List.push_front (!attach_format, s) attach in
let cache = ref Paths.xdg_cache_home in
let set_cache arg = cache := Some arg in
let no_cache () = cache := None in
let check_signature = ref true in
let curl = ref "curl" in
let delete_on_failure = ref true in
let fingerprints = ref [] in
let add_fingerprint arg = List.push_front arg fingerprints in
let format = ref "" in
let gpg =
try which "gpg2"
with Executable_not_found _ ->
try which "gpg"
with Executable_not_found _ ->
"" in
let gpg = ref gpg in
let list_format = ref List_entries.Short in
let list_set_long () = list_format := List_entries.Long in
let list_set_format arg =
(* Do not catch the Invalid_argument that list_format_of_string
* throws on invalid input, as it is already checked by the
* Getopt handling of Symbol. *)
list_format := List_entries.list_format_of_string arg in
let memsize = ref None in
let set_memsize arg = memsize := Some arg in
let network = ref true in
let output = ref "" in
let size = ref None in
let set_size arg = size := Some (parse_size arg) in
let smp = ref None in
let set_smp arg = smp := Some arg in
let sources = ref [] in
let add_source arg = List.push_front arg sources in
let sync = ref true in
let warn_if_partition = ref true in
let formats = List_entries.list_formats
and formats_string = String.concat "|" List_entries.list_formats in
let argspec = [
[ L"arch" ], Getopt.Set_string ("arch", arch), s_"Set the output architecture";
[ L"attach" ], Getopt.String ("iso", attach_disk), s_"Attach data disk/ISO during install";
[ L"attach-format" ], Getopt.String ("format", set_attach_format),
s_"Set attach disk format";
[ L"cache" ], Getopt.String ("dir", set_cache), s_"Set template cache dir";
[ L"no-cache" ], Getopt.Unit no_cache, s_"Disable template cache";
[ L"cache-all-templates" ], Getopt.Unit cache_all_mode,
s_"Download all templates to the cache";
[ L"check-signature"; L"check-signatures" ], Getopt.Set check_signature,
s_"Check digital signatures";
[ L"no-check-signature"; L"no-check-signatures" ], Getopt.Clear check_signature,
s_"Disable digital signatures";
[ L"curl" ], Getopt.Set_string ("curl", curl), s_"Set curl binary/command";
[ L"delete-cache" ], Getopt.Unit delete_cache_mode,
s_"Delete the template cache";
[ L"no-delete-on-failure" ], Getopt.Clear delete_on_failure,
s_"Dont delete output file on failure";
[ L"fingerprint" ], Getopt.String ("AAAA..", add_fingerprint),
s_"Fingerprint of valid signing key";
[ L"format" ], Getopt.Set_string ("raw|qcow2", format), s_"Output format (default: raw)";
[ L"get-kernel" ], Getopt.Unit get_kernel_mode,
s_"Get kernel from image";
[ L"gpg" ], Getopt.Set_string ("gpg", gpg), s_"Set GPG binary/command";
[ S 'l'; L"list" ], Getopt.Unit list_mode, s_"List available templates";
[ L"long" ], Getopt.Unit list_set_long, s_"Shortcut for --list-format long";
[ L"list-format" ], Getopt.Symbol (formats_string, formats, list_set_format),
s_"Set the format for --list (default: short)";
[ S 'm'; L"memsize" ], Getopt.Int ("mb", set_memsize), s_"Set memory size";
[ L"network" ], Getopt.Set network, s_"Enable appliance network (default)";
[ L"no-network" ], Getopt.Clear network, s_"Disable appliance network";
[ L"notes" ], Getopt.Unit notes_mode, s_"Display installation notes";
[ S 'o'; L"output" ], Getopt.Set_string ("file", output), s_"Set output filename";
[ L"print-cache" ], Getopt.Unit print_cache_mode,
s_"Print info about template cache";
[ L"size" ], Getopt.String ("size", set_size), s_"Set output disk size";
[ L"smp" ], Getopt.Int ("vcpus", set_smp), s_"Set number of vCPUs";
[ L"source" ], Getopt.String ("URL", add_source), s_"Set source URL";
[ L"no-sync" ], Getopt.Clear sync, s_"Do not fsync output file on exit";
[ L"no-warn-if-partition" ], Getopt.Clear warn_if_partition,
s_"Do not warn if writing to a partition";
] in
let customize_argspec, get_customize_ops = Customize_cmdline.argspec () in
let customize_argspec =
List.map (fun (spec, _, _) -> spec) customize_argspec in
let argspec = argspec @ customize_argspec in
let args = ref [] in
let anon_fun s = List.push_front s args in
let usage_msg =
sprintf (f_"\
%s: build virtual machine images quickly
virt-builder OS-VERSION
virt-builder -l
virt-builder --notes OS-VERSION
virt-builder --print-cache
virt-builder --cache-all-templates
virt-builder --delete-cache
virt-builder --get-kernel IMAGE
A short summary of the options is given below. For detailed help please
read the man page virt-builder(1).
")
prog in
let opthandle = create_standard_options argspec ~anon_fun ~machine_readable:true usage_msg in
Getopt.parse opthandle.getopt;
(* Dereference options. *)
let args = List.rev !args in
let mode = !mode in
let arch = !arch in
let attach = List.rev !attach in
let cache = !cache in
let check_signature = !check_signature in
let curl = !curl in
let delete_on_failure = !delete_on_failure in
let fingerprints = List.rev !fingerprints in
let format = match !format with "" -> None | s -> Some s in
let gpg = !gpg in
let list_format = !list_format in
let memsize = !memsize in
let network = !network in
let ops = get_customize_ops () in
let output = match !output with "" -> None | s -> Some s in
let size = !size in
let smp = !smp in
let sources = List.rev !sources in
let sync = !sync in
let warn_if_partition = !warn_if_partition in
(* No arguments and machine-readable mode? Print some facts. *)
(match args, machine_readable () with
| [], Some { pr } ->
pr "virt-builder\n";
pr "arch\n";
pr "config-file\n";
pr "customize\n";
pr "json-list\n";
if Pxzcat.using_parallel_xzcat () then pr "pxzcat\n";
exit 0
| _, _ -> ()
);
(* Check options. *)
let arg =
match mode with
| `Install ->
(match args with
| [arg] -> arg
| [] ->
error (f_"virt-builder os-version\nMissing os-version. Use --list to list available template names.")
| _ ->
error (f_"too many parameters, expecting os-version")
)
| `List ->
if format <> None then
error (f_"--list: use --list-format, not --format");
(match args with
| [arg] -> arg
| [] -> ""
| _ ->
error (f_"too many parameters, at most one os-version is allowed for --list")
)
| `Notes ->
(match args with
| [arg] -> arg
| [] ->
error (f_"virt-builder --notes os-version\nMissing os-version. Use --list to list available template names.")
| _ ->
error (f_"--notes: too many parameters, expecting os-version");
)
| `Cache_all
| `Print_cache
| `Delete_cache ->
(match args with
| [] -> ""
| _ ->
error (f_"--cache-all-templates/--print-cache/--delete-cache does not need any extra arguments")
)
| `Get_kernel ->
(match args with
| [arg] -> arg
| [] ->
error (f_"virt-builder --get-kernel image\nMissing image (disk image file) argument")
| _ ->
error (f_"--get-kernel: too many parameters")
) in
(* Check source(s) and fingerprint(s). *)
let sources =
let rec repeat x = function
| 0 -> [] | 1 -> [x]
| n -> x :: repeat x (n-1)
in
let nr_sources = List.length sources in
let fingerprints =
if check_signature then (
match fingerprints with
| [fingerprint] ->
(* You're allowed to have multiple sources and one fingerprint: it
* means that the same fingerprint is used for all sources.
*)
repeat fingerprint nr_sources
| xs -> xs
) else
(* We are not checking signatures, so just ignore any fingerprint
* specified. *)
repeat "" nr_sources in
if List.length fingerprints <> nr_sources then
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
(* Check the architecture. *)
let arch =
match arch with
| "" -> Guestfs_config.host_cpu
| arch -> arch in
let arch = normalize_arch arch in
(* If user didn't elect any root password, that means we set a random
* root password.
*)
let customize_ops =
let has_set_root_password = List.exists (
function `RootPassword _ -> true | _ -> false
) ops.ops in
if has_set_root_password then ops
else (
let pw = Password.parse_selector "random" in
{ ops with ops = ops.ops @ [ `RootPassword pw ] }
) in
{ mode = mode; arg = arg;
arch = arch; attach = attach; cache = cache;
check_signature = check_signature; curl = curl;
customize_ops = customize_ops;
delete_on_failure = delete_on_failure; format = format;
gpg = gpg; list_format = list_format; memsize = memsize;
network = network; output = output;
size = size; smp = smp; sources = sources; sync = sync;
warn_if_partition = warn_if_partition;
}

View File

@@ -1,45 +0,0 @@
(* virt-builder
* Copyright (C) 2013-2019 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
(** Command line argument parsing. *)
type cmdline = {
mode : [ `Cache_all | `Delete_cache | `Get_kernel | `Install | `List
| `Notes | `Print_cache ];
arg : string;
arch : string;
attach : (string option * string) list;
cache : string option;
check_signature : bool;
curl : string;
customize_ops : Customize_cmdline.ops;
delete_on_failure : bool;
format : string option;
gpg : string;
list_format : List_entries.format;
memsize : int option;
network : bool;
output : string option;
size : int64 option;
smp : int option;
sources : (string * string) list;
sync : bool;
warn_if_partition : bool;
}
val parse_cmdline : unit -> cmdline

View File

@@ -1,144 +0,0 @@
(* virt-builder
* Copyright (C) 2013 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
open Std_utils
open Tools_utils
open Common_gettext.Gettext
open Utils
open Unix
open Printf
type uri = string
type filename = string
type t = {
curl : string;
tmpdir : string;
cache : Cache.t option; (* cache for templates *)
}
let create ~curl ~tmpdir ~cache = {
curl = curl;
tmpdir = tmpdir;
cache = cache;
}
let rec download t ?template ?progress_bar ?(proxy = Curl.SystemProxy) uri =
match template with
| None -> (* no cache, simple download *)
(* Create a temporary name. *)
let tmpfile = Filename.temp_file ~temp_dir:t.tmpdir "vbcache" ".txt" in
download_to t ?progress_bar ~proxy uri tmpfile;
(tmpfile, true)
| Some (name, arch, revision) ->
match t.cache with
| None ->
(* Not using the cache at all? *)
download t ?progress_bar ~proxy uri
| Some cache ->
let filename = Cache.cache_of_name cache name arch revision in
(* Is the requested template name + revision in the cache already?
* If not, download it.
*)
if not (Sys.file_exists filename) then
download_to t ?progress_bar ~proxy uri filename;
(filename, false)
and download_to t ?(progress_bar = false) ~proxy uri filename =
let parseduri =
try URI.parse_uri uri
with URI.Parse_failed ->
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
* fails, we download to a random name in the cache and then
* atomically rename it to the final filename.
*)
let filename_new = filename ^ "." ^ String.random8 () in
unlink_on_exit filename_new;
(match parseduri.URI.protocol with
(* Download (ie. copy) from a local file. *)
| "file" ->
let path = parseduri.URI.path in
let cmd = [ "cp" ] @
(if verbose () then [ "-v" ] else []) @
[ path; filename_new ] in
let r = run_command cmd in
if r <> 0 then
error (f_"cp (download) command failed copying %s") path;
(* Any other protocol. *)
| _ ->
let common_args = [
"location", None; (* Follow 3xx redirects. *)
"url", Some uri; (* URI to download. *)
] in
let quiet_args = [ "silent", None; "show-error", None ] in
(* Get the status code first to ensure the file exists. *)
let curl_h =
let curl_args = ref common_args in
if not (verbose ()) then List.push_back_list curl_args quiet_args;
List.push_back_list curl_args [
"output", Some "/dev/null"; (* Write output to /dev/null. *)
"head", None; (* Request only HEAD. *)
"write-out", Some "%{http_code}" (* HTTP status code to stdout. *)
];
Curl.create ~curl:t.curl ~tmpdir:t.tmpdir !curl_args in
let lines = Curl.run curl_h in
if List.length lines < 1 then
error (f_"unexpected output from curl command, enable debug and look at previous messages");
let status_code = List.hd lines in
let bad_status_code = function
| "" -> true
| s when s.[0] = '4' -> true (* 4xx *)
| s when s.[0] = '5' -> true (* 5xx *)
| _ -> false
in
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 curl_h =
let curl_args = ref common_args in
List.push_back curl_args ("output", Some filename_new);
if not (verbose ()) then (
if progress_bar then List.push_back curl_args ("progress-bar", None)
else List.push_back_list curl_args quiet_args
);
Curl.create ~curl:t.curl ~tmpdir:t.tmpdir !curl_args in
ignore (Curl.run curl_h)
);
(* Rename the file if the download was successful. *)
rename filename_new filename

View File

@@ -1,45 +0,0 @@
(* virt-builder
* Copyright (C) 2013 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
(** This module is a wrapper around curl, plus local caching. *)
type uri = string
type filename = string
type t
(** The abstract data type. *)
val create : curl:string -> tmpdir:string -> cache:Cache.t option -> t
(** Create the abstract type. *)
val download : t -> ?template:string * Index.arch * Utils.revision -> ?progress_bar:bool -> ?proxy:Curl.proxy -> uri -> filename * bool
(** Download the URI, returning the downloaded filename and a
temporary file flag. The temporary file flag is [true] iff
the downloaded file is temporary and should be deleted by the
caller (otherwise it's in the cache and you shouldn't delete it).
For templates, you must supply [~template:(name, arch, revision)].
This causes the cache to be used (if possible). Name, arch(itecture)
and revision are used for cache control (see the man page for details).
If [~progress_bar:true] then display a progress bar if the file
doesn't come from the cache. In verbose mode, progress messages
are always displayed.
[proxy] specifies the type of proxy to be used in the transfer,
if possible. *)

View File

@@ -1,184 +0,0 @@
/* libguestfs virt-builder tool -*- fundamental -*-
* Copyright (C) 2013 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
%{
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "index-struct.h"
#include "index-parse.h"
/* The generated code uses frames > 5000 bytes. */
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wframe-larger-than="
#pragma GCC diagnostic ignored "-Wstack-usage="
#endif
#define YY_EXTRA_TYPE struct parse_context *
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);
/* Join two strings with \n */
static char *
concat_newline (const char *str1, const char *str2)
{
size_t len1, len2, len;
char *ret;
if (str2 == NULL)
return strdup (str1);
len1 = strlen (str1);
len2 = strlen (str2);
len = len1 + 1 /* \n */ + len2 + 1 /* \0 */;
ret = malloc (len);
memcpy (ret, str1, len1);
ret[len1] = '\n';
memcpy (ret + len1 + 1, str2, len2);
ret[len-1] = '\0';
return ret;
}
%}
%code requires {
#ifndef YY_TYPEDEF_YY_SCANNER_T
#define YY_TYPEDEF_YY_SCANNER_T
typedef void *yyscan_t;
#endif
}
%locations
%union {
struct section *section;
struct field *field;
char *str;
}
%token <str> SECTION_HEADER
%token <field> FIELD
%token <str> VALUE_CONT
%token EMPTY_LINE
%token PGP_PROLOGUE
%token PGP_EPILOGUE
%token UNKNOWN_LINE
%type <section> sections section
%type <field> fields field
%type <str> continuations
%pure-parser
%lex-param { yyscan_t scanner }
%parse-param { yyscan_t scanner }
%parse-param { struct parse_context *context }
%destructor { section_free ($$); } <section>
%destructor { field_free ($$); } <field>
%%
index:
sections
{ context->parsed_index = $1; }
| PGP_PROLOGUE sections PGP_EPILOGUE
{ context->parsed_index = $2; }
sections:
emptylines section emptylines
{ $$ = $2; }
| emptylines section EMPTY_LINE emptylines sections
{ $$ = $2; $$->next = $5; }
| emptylines
{ $$ = NULL; }
section:
SECTION_HEADER fields
{ $$ = malloc (sizeof (struct section));
$$->next = NULL;
$$->name = $1;
$$->fields = $2; }
fields:
/* empty */
{ $$ = NULL; }
| field fields
{ $$ = $1; $$->next = $2; }
field: FIELD continuations
{ $$ = $1;
char *old_value = $$->value;
$$->value = concat_newline (old_value, $2);
free (old_value);
free ($2); }
continuations:
/* empty */
{ $$ = NULL; }
| VALUE_CONT continuations
{ $$ = concat_newline ($1, $2);
free ($1);
free ($2); }
emptylines:
/* empty */
{}
| EMPTY_LINE emptylines
{}
%%
void
yyerror (YYLTYPE * yylloc, yyscan_t scanner, struct parse_context *context, const char *msg)
{
const int has_suffix =
context->error_suffix != NULL && context->error_suffix[0] != 0;
fprintf (stderr, "%s%s%s%ssyntax error at line %d: %s%s%s\n",
context->progname ? context->progname : "",
context->progname ? ": " : "",
context->input_file ? context->input_file : "",
context->input_file ? ": " : "",
yylloc->first_line, msg,
has_suffix ? " " : "",
has_suffix ? context->error_suffix : "");
}
int
do_parse (struct parse_context *context, FILE *in)
{
yyscan_t scanner;
int res;
scanner_init (&scanner, context, in);
res = yyparse (scanner, context);
scanner_destroy (scanner);
return res;
}

View File

@@ -1,116 +0,0 @@
/* virt-builder
* Copyright (C) 2013 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/**
* This file handles the interface between the C/lex/yacc index file
* parser, and the OCaml world. See F<builder/index_parser.ml> for
* the OCaml type definition.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <caml/alloc.h>
#include <caml/fail.h>
#include <caml/memory.h>
#include <caml/mlvalues.h>
#include <caml/unixsupport.h>
#include "index-struct.h"
#include "index-parse.h"
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)
{
CAMLparam2 (progv, filenamev);
CAMLlocal5 (rv, v, sv, sv2, fv);
struct section *sections;
size_t i, nr_sections;
struct parse_context context;
FILE *in;
parse_context_init (&context);
context.progname = String_val (progv);
context.input_file = String_val (filenamev);
context.error_suffix = String_val (error_suffixv);
in = fopen (String_val (filenamev), "r");
if (in == NULL)
unix_error (errno, (char *) "fopen", filenamev);
if (do_parse (&context, in) != 0) {
fclose (in);
caml_invalid_argument ("parse error");
}
if (fclose (in) == EOF)
unix_error (errno, (char *) "fclose", filenamev);
/* Convert the parsed data to OCaml structures. */
nr_sections = 0;
for (sections = context.parsed_index; sections != NULL; sections = sections->next)
nr_sections++;
rv = caml_alloc (nr_sections, 0);
for (i = 0, sections = context.parsed_index; sections != NULL;
i++, sections = sections->next) {
struct field *fields;
size_t j, nr_fields;
nr_fields = 0;
for (fields = sections->fields; fields != NULL; fields = fields->next)
nr_fields++;
fv = caml_alloc (nr_fields, 0);
for (j = 0, fields = sections->fields; fields != NULL;
j++, fields = fields->next) {
v = caml_alloc_tuple (3);
sv = caml_copy_string (fields->key);
Store_field (v, 0, sv); /* (key, Some subkey, value) */
if (fields->subkey) {
sv2 = caml_copy_string (fields->subkey);
sv = caml_alloc (1, 0);
Store_field (sv, 0, sv2);
} else
sv = Val_int (0);
Store_field (v, 1, sv);
sv = caml_copy_string (fields->value);
Store_field (v, 2, sv);
Store_field (fv, j, v); /* assign to return array of fields */
}
v = caml_alloc_tuple (2);
sv = caml_copy_string (sections->name);
Store_field (v, 0, sv); /* (name, fields) */
Store_field (v, 1, fv);
Store_field (rv, i, v); /* assign to return array of sections */
}
/* Free parsed data. */
parse_context_free (&context);
CAMLreturn (rv);
}

View File

@@ -1,153 +0,0 @@
/* libguestfs virt-builder tool -*- fundamental -*-
* Copyright (C) 2013 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
%top{
#include <config.h>
}
%{
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Silence gcc warnings from the generated code. */
#if defined(__GNUC__)
#pragma GCC diagnostic push
/* flex creates macros that it doesn't use */
#pragma GCC diagnostic ignored "-Wunused-macros"
/* on aarch64, flex doesn't know that char is unsigned */
#pragma GCC diagnostic ignored "-Wsign-compare"
/* on debian-mipsel, flex doesn't create prototypes for all functions */
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif
#include "index-struct.h"
#include "index-parse.h"
#define YY_EXTRA_TYPE struct parse_context *
#define YY_USER_ACTION yylloc->first_line = yylloc->last_line = yylineno;
extern void scanner_init (yyscan_t *scanner, struct parse_context *context, FILE *in);
extern void scanner_destroy (yyscan_t scanner);
#if (YY_FLEX_MAJOR_VERSION > 2) \
|| ((YY_FLEX_MAJOR_VERSION == 2) && (YY_FLEX_MINOR_VERSION > 6)) \
|| ((YY_FLEX_MAJOR_VERSION == 2) && (YY_FLEX_MINOR_VERSION == 6) && (YY_FLEX_SUBMINOR_VERSION >= 1))
#define IS_EOF 0
#else
#define IS_EOF EOF
#endif
%}
%option nounput
%option noyywrap
%option yylineno
%option reentrant
%option bison-bridge
%option bison-locations
%%
/* Apart from the PGP prologue/epilogue which is a hack, the
* scanning strategy is to deal with the file strictly line by
* line, and pass those lines up to the parser which deals with
* whether they appear in the right order to be meaningful.
* Note that flex does longest-match.
*/
/* Ignore comments - '#' MUST appear at the start of a line. */
^"#".*\n { yyextra->seen_comments++; }
/* An empty line is significant. */
^\n { return EMPTY_LINE; }
/* [...] marks beginning of a section. */
^"["[-A-Za-z0-9._]+"]"[[:blank:]]*\n {
const char *end = strrchr (yytext, ']');
yylval->str = strndup (yytext+1, end-yytext-1);
return SECTION_HEADER;
}
/* field=value or field[subfield]=value */
^[A-Za-z0-9_.]+("["[A-Za-z0-9_,.]+"]")?"=".*\n {
size_t i = strcspn (yytext, "=[");
yylval->field = malloc (sizeof (struct field));
yylval->field->next = NULL;
yylval->field->key = strndup (yytext, i);
if (yytext[i] == '[') {
const size_t j = strcspn (yytext+i+1, "]");
yylval->field->subkey = strndup (yytext+i+1, j);
i += 1+j+1;
} else {
yylval->field->subkey = NULL;
}
/* Note we chop the final \n off here. */
yylval->field->value = strndup (yytext+i+1, yyleng-(i+2));
return FIELD;
}
/* Continuation line for multi-line values. */
^[[:blank:]].*\n {
yylval->str = strndup (yytext+1, yyleng-2);
return VALUE_CONT;
}
/* Hack to eat the PGP prologue. */
^"-----BEGIN PGP SIGNED MESSAGE-----\n" {
int c, prevnl = 0;
/* Eat everything to the first blank line. */
while ((c = input (yyscanner)) != IS_EOF) {
if (c == '\n' && prevnl)
break;
prevnl = c == '\n';
}
return PGP_PROLOGUE;
}
/* Hack to eat the PGP epilogue. */
^"-----BEGIN PGP SIGNATURE-----\n" {
/* Eat everything to the end of the file. */
while (input (yyscanner) != IS_EOF)
;
return PGP_EPILOGUE;
}
/* anything else is an error */
. {
return UNKNOWN_LINE;
}
%%
void
scanner_init (yyscan_t *scanner, struct parse_context *context, FILE *in)
{
yylex_init (scanner);
yyset_extra (context, *scanner);
yyset_in (in, *scanner);
}
void
scanner_destroy (yyscan_t scanner)
{
yylex_destroy (scanner);
}

View File

@@ -1,60 +0,0 @@
/* libguestfs virt-builder tool
* Copyright (C) 2013 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "index-struct.h"
void
parse_context_init (struct parse_context *context)
{
memset (context, 0, sizeof *context);
}
void
parse_context_free (struct parse_context *context)
{
section_free (context->parsed_index);
}
void
section_free (struct section *section)
{
if (section) {
section_free (section->next);
free (section->name);
field_free (section->fields);
free (section);
}
}
void
field_free (struct field *field)
{
if (field) {
field_free (field->next);
free (field->key);
free (field->subkey);
free (field->value);
free (field);
}
}

View File

@@ -1,67 +0,0 @@
/* libguestfs virt-builder tool
* Copyright (C) 2013 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* The data structures produced when parsing the index file. */
#ifndef INDEX_STRUCT_H
#define INDEX_STRUCT_H
/* A section or list of sections. */
struct section {
struct section *next;
char *name;
struct field *fields;
};
/* A field or list of fields. */
struct field {
struct field *next;
char *key;
char *subkey;
char *value;
};
/* A struct holding the data needed during the parsing. */
struct parse_context {
struct section *parsed_index; /* The result of the parsing. */
/* yyparse sets this if any comments were seen. Required for checking
* compatibility with virt-builder 1.24.
*/
int seen_comments;
const char *input_file;
const char *progname;
const char *error_suffix;
};
/* Initialize the content of a parse_context. */
extern void parse_context_init (struct parse_context *state);
/* Free the content of a parse_context. The actual pointer is not freed. */
extern void parse_context_free (struct parse_context *state);
/* Free the content of a section, recursively freeing also its fields.
* The actual pointer is not freed.
*/
extern void section_free (struct section *section);
/* Free the content of a field, recursively freeing also its next field.
* The actual pointer is not freed.
*/
extern void field_free (struct field *field);
#endif /* INDEX_STRUCT_H */

View File

@@ -1,186 +0,0 @@
/* libguestfs virt-builder tool
* Copyright (C) 2013 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <getopt.h>
#include <error.h>
#include <errno.h>
#include <locale.h>
#include <libintl.h>
#include <guestfs.h>
#include "getprogname.h"
#include "guestfs-utils.h"
#include "index-struct.h"
#include "index-parse.h"
extern int do_parse (struct parse_context *context, FILE *in);
static void __attribute__((noreturn))
usage (int exit_status)
{
printf ("%s index\n", getprogname ());
exit (exit_status);
}
int
main (int argc, char *argv[])
{
enum { HELP_OPTION = CHAR_MAX + 1 };
static const char options[] = "V";
static const struct option long_options[] = {
{ "help", 0, 0, HELP_OPTION },
{ "compat-1.24.0", 0, 0, 0 },
{ "compat-1.24.1", 0, 0, 0 },
{ "version", 0, 0, 'V' },
{ 0, 0, 0, 0 }
};
int c;
int option_index;
int compat_1_24_0 = 0;
int compat_1_24_1 = 0;
const char *input;
struct section *sections;
struct parse_context context;
FILE *in;
int ret;
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEBASEDIR);
textdomain (PACKAGE);
parse_context_init (&context);
for (;;) {
c = getopt_long (argc, argv, options, long_options, &option_index);
if (c == -1) break;
switch (c) {
case 0: /* options which are long only */
if (STREQ (long_options[option_index].name, "compat-1.24.0"))
compat_1_24_0 = compat_1_24_1 = 1;
else if (STREQ (long_options[option_index].name, "compat-1.24.1"))
compat_1_24_1 = 1;
else
error (EXIT_FAILURE, 0,
_("unknown long option: %s (%d)"),
long_options[option_index].name, option_index);
break;
case 'V':
printf ("%s %s%s\n",
getprogname (),
PACKAGE_VERSION, PACKAGE_VERSION_EXTRA);
exit (EXIT_SUCCESS);
case HELP_OPTION:
usage (EXIT_SUCCESS);
default:
usage (EXIT_FAILURE);
}
}
if (optind != argc-1)
usage (EXIT_FAILURE);
input = argv[optind++];
in = fopen (input, "r");
if (in == NULL)
error (EXIT_FAILURE, errno, "fopen: %s", input);
ret = do_parse (&context, in);
if (fclose (in) == EOF) {
fprintf (stderr, _("%s: %s: error closing input file: %m (ignored)\n"),
getprogname (), input);
}
if (ret != 0) {
parse_context_free (&context);
error (EXIT_FAILURE, 0,
_("%s could not be validated, see errors above"), input);
}
if (compat_1_24_1 && context.seen_comments) {
parse_context_free (&context);
error (EXIT_FAILURE, 0,
_("%s contains comments which will not work with virt-builder 1.24.1"),
input);
}
/* Iterate over the parsed sections, semantically validating it. */
for (sections = context.parsed_index; sections != NULL; sections = sections->next) {
int seen_sig = 0;
struct field *fields;
if (compat_1_24_0) {
if (strchr (sections->name, '_')) {
parse_context_free (&context);
error (EXIT_FAILURE, 0,
_("%s: section [%s] has invalid characters which will not work with virt-builder 1.24.0"),
input, sections->name);
}
}
for (fields = sections->fields; fields != NULL; fields = fields->next) {
if (compat_1_24_0) {
if (strchr (fields->key, '[') ||
strchr (fields->key, ']')) {
parse_context_free (&context);
error (EXIT_FAILURE, 0,
_("%s: section [%s], field %s has invalid characters which will not work with virt-builder 1.24.0"),
input, sections->name, fields->key);
}
}
if (compat_1_24_1) {
if (strchr (fields->key, '.') ||
strchr (fields->key, ',')) {
parse_context_free (&context);
error (EXIT_FAILURE, 0,
_("%s: section [%s], field %s has invalid characters which will not work with virt-builder 1.24.1"),
input, sections->name, fields->key);
}
}
if (STREQ (fields->key, "sig"))
seen_sig = 1;
}
if (compat_1_24_0 && !seen_sig) {
parse_context_free (&context);
error (EXIT_FAILURE, 0,
_("%s: section [%s] is missing a sig field which will not work with virt-builder 1.24.0"),
input, sections->name);
}
}
/* Free the parsed data. */
parse_context_free (&context);
printf ("%s validated OK\n", input);
exit (EXIT_SUCCESS);
}

View File

@@ -1,86 +0,0 @@
(* virt-builder
* Copyright (C) 2013-2019 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
open Std_utils
open Tools_utils
open Common_gettext.Gettext
open Utils
open Printf
open Unix
type index = (string * entry) list (* string = "os-version" *)
and entry = {
printable_name : string option; (* the name= field *)
osinfo : string option;
file_uri : string;
arch : arch;
signature_uri : string option; (* deprecated, will be removed in 1.26 *)
checksums : Checksums.csum_t list option;
revision : Utils.revision;
format : string option;
size : int64;
compressed_size : int64 option;
expand : string option;
lvexpand : string option;
notes : (string * string) list;
hidden : bool;
aliases : string list option;
sigchecker : Sigchecker.t;
proxy : Curl.proxy;
}
and arch =
| Arch of string
| GuessedArch of string
let string_of_arch = function Arch a | GuessedArch a -> a
let print_entry chan (name, { printable_name; file_uri; arch; osinfo;
signature_uri; checksums; revision; format;
size; compressed_size; expand; lvexpand;
notes; aliases; hidden }) =
let fp fs = fprintf chan fs in
fp "[%s]\n" name;
Option.may (fp "name=%s\n") printable_name;
Option.may (fp "osinfo=%s\n") osinfo;
fp "file=%s\n" file_uri;
fp "arch=%s\n" (string_of_arch arch);
Option.may (fp "sig=%s\n") signature_uri;
Option.may (
List.iter (
fun c ->
fp "checksum[%s]=%s\n"
(Checksums.string_of_csum_t c) (Checksums.string_of_csum c)
)
) checksums;
fp "revision=%s\n" (string_of_revision revision);
Option.may (fp "format=%s\n") format;
fp "size=%Ld\n" size;
Option.may (fp "compressed_size=%Ld\n") compressed_size;
Option.may (fp "expand=%s\n") expand;
Option.may (fp "lvexpand=%s\n") lvexpand;
List.iter (
fun (lang, notes) ->
match lang with
| "" -> fp "notes=%s\n" notes
| lang -> fp "notes[%s]=%s\n" lang notes
) notes;
Option.may (fun l -> fp "aliases=%s\n" (String.concat " " l)) aliases;
if hidden then fp "hidden=true\n"

View File

@@ -1,50 +0,0 @@
(* virt-builder
* Copyright (C) 2013-2019 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
type index = (string * entry) list (* string = "os-version" *)
and entry = {
printable_name : string option; (* the name= field *)
osinfo : string option;
file_uri : string;
arch : arch;
signature_uri : string option; (* deprecated, will be removed in 1.26 *)
checksums : Checksums.csum_t list option;
revision : Utils.revision;
format : string option;
size : int64;
compressed_size : int64 option;
expand : string option;
lvexpand : string option;
notes : (string * string) list;
hidden : bool;
aliases : string list option;
sigchecker : Sigchecker.t;
proxy : Curl.proxy;
}
and arch =
| Arch of string (** Specified in the metadata. *)
| GuessedArch of string (** Guess from inspection data. *)
val string_of_arch : arch -> string
(** [string_of_arch a]Get the string value of [a]. *)
val print_entry : out_channel -> (string * entry) -> unit
(** Debugging helper function dumping an index entry to a stream.
To write entries for non-debugging purpose, use the
[Index_parser.write_entry] function. *)

View File

@@ -1,306 +0,0 @@
(* virt-builder
* Copyright (C) 2013 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
open Std_utils
open Tools_utils
open Common_gettext.Gettext
open Utils
open Printf
open Unix
let get_index ~downloader ~sigchecker ?(template = false) { Sources.uri; proxy } =
let corrupt_file () =
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, _ = Downloader.download downloader ~proxy uri in
(* Check index file signature (also verifies it was fully
* downloaded and not corrupted in transit).
*)
Sigchecker.verify sigchecker tmpfile;
(* Try parsing the file. *)
let sections = Ini_reader.read_ini tmpfile in
(* Check for repeated os-version+arch combination. *)
let name_arch_map = List.map (
fun (n, fields) ->
let rec find_arch = function
| ("arch", None, value) :: y -> value
| _ :: y -> find_arch y
| [] -> ""
in
n, (find_arch fields)
) sections in
let nseen = Hashtbl.create 13 in
List.iter (
fun (n, arch) ->
let id = n, arch in
if Hashtbl.mem nseen id then (
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
) name_arch_map;
(* Check for repeated fields. *)
List.iter (
fun (n, fields) ->
let fseen = Hashtbl.create 13 in
List.iter (
fun (field, subkey, _) ->
let hashkey = (field, subkey) in
if Hashtbl.mem fseen hashkey then (
(match subkey with
| Some value ->
eprintf (f_"%s: index is corrupt: %s: field %s[%s] appears two or more times\n") prog n field value
| None ->
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
) fields
) sections;
(* Turn the sections into the final index. *)
let entries =
List.map (
fun (n, fields) ->
let fields = List.map (fun (k, sk, v) -> (k, sk), v) fields in
let printable_name =
try Some (List.assoc ("name", None) fields) with Not_found -> None in
let osinfo =
try Some (List.assoc ("osinfo", None) fields) with Not_found -> None in
let file_uri =
try make_absolute_uri (List.assoc ("file", None) fields)
with Not_found ->
eprintf (f_"%s: no file (URI) entry for %s\n") prog n;
corrupt_file () in
let arch =
try Index.Arch (List.assoc ("arch", None) fields)
with Not_found ->
if template then
let g = open_guestfs ~identifier:"template" () in
g#add_drive_ro file_uri;
g#launch ();
let roots = g#inspect_os () in
let nroots = Array.length roots in
if nroots <> 1 then (
eprintf (f_"%s: no arch entry for %s and failed to guess it\n") prog n;
corrupt_file ()
);
let inspected_arch = g#inspect_get_arch (Array.get roots 0) in
g#close();
Index.GuessedArch inspected_arch
else (
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))
with Not_found -> None in
let checksum_sha512 =
try Some (List.assoc ("checksum", Some "sha512") fields)
with Not_found ->
try Some (List.assoc ("checksum", None) fields)
with Not_found -> None in
let revision =
try Rev_int (int_of_string (List.assoc ("revision", None) fields))
with
| Not_found -> if template then Rev_int 0 else Rev_int 1
| Failure _ ->
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
let size =
let get_image_size filepath =
(* If a compressed image manages to reach this code, qemu-img just
returns a virtual-size equal to actual-size *)
match detect_file_type filepath with
| `Unknown ->
let infos = Utils.get_image_infos filepath in
JSON_parser.object_get_number "virtual-size" infos
| `XZ | `GZip | `Tar | ` Zip ->
eprintf (f_"%s: cannot determine the virtual size of %s due to compression")
prog filepath;
corrupt_file () in
try Int64.of_string (List.assoc ("size", None) fields)
with
| Not_found ->
if template then
get_image_size file_uri
else (
eprintf (f_"%s: no size field for %s\n") prog n;
corrupt_file ()
)
| Failure _ ->
if template then
get_image_size file_uri
else (
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))
with
| Not_found ->
None
| Failure _ ->
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
let lvexpand =
try Some (List.assoc ("lvexpand", None) fields) with Not_found -> None in
let notes =
let rec loop = function
| [] -> []
| (("notes", subkey), value) :: xs ->
let subkey = match subkey with
| None -> ""
| Some v -> v in
(subkey, value) :: loop xs
| _ :: xs -> loop xs in
List.sort (
fun (k1, _) (k2, _) ->
String.compare k1 k2
) (loop fields) in
let hidden =
try bool_of_string (List.assoc ("hidden", None) fields)
with
| Not_found -> false
| Failure _ ->
eprintf (f_"%s: cannot parse hidden field for %s\n")
prog n;
corrupt_file () in
let aliases =
let l =
try String.nsplit " " (List.assoc ("aliases", None) fields)
with Not_found -> [] in
match l with
| [] -> None
| l -> Some l in
let checksums =
match checksum_sha512 with
| Some c -> Some [Checksums.SHA512 c]
| None -> None in
let entry = { Index.printable_name = printable_name;
osinfo = osinfo;
file_uri = file_uri;
arch = arch;
signature_uri = signature_uri;
checksums = checksums;
revision = revision;
format = format;
size = size;
compressed_size = compressed_size;
expand = expand;
lvexpand = lvexpand;
notes = notes;
hidden = hidden;
aliases = aliases;
proxy = proxy;
sigchecker = sigchecker } in
n, entry
) sections in
if verbose () then (
printf "index file (%s) after parsing (C parser):\n" uri;
List.iter (Index.print_entry Pervasives.stdout) entries
);
entries
(* Verify same-origin policy for the file= and sig= fields. *)
and make_absolute_uri path =
if String.length path = 0 then (
eprintf (f_"%s: zero length path in the index file\n") prog;
corrupt_file ()
)
else if String.find path "://" >= 0 then (
eprintf (f_"%s: cannot use a URI (%s) in the index file\n") prog path;
corrupt_file ()
)
else if path.[0] = '/' then (
eprintf (f_"%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 uri '/' in
String.sub uri 0 (i+1) ^ path
with
Not_found -> uri // path
)
in
get_index ()
let write_entry chan (name, { Index.printable_name; file_uri; arch; osinfo;
signature_uri; checksums; revision; format; size;
compressed_size; expand; lvexpand; notes;
aliases; hidden}) =
let fp fs = fprintf chan fs in
fp "[%s]\n" name;
Option.may (fp "name=%s\n") printable_name;
Option.may (fp "osinfo=%s\n") osinfo;
fp "file=%s\n" file_uri;
fp "arch=%s\n" (Index.string_of_arch arch);
Option.may (fp "sig=%s\n") signature_uri;
(match checksums with
| None -> ()
| Some checksums ->
List.iter (
fun c ->
fp "checksum[%s]=%s\n"
(Checksums.string_of_csum_t c) (Checksums.string_of_csum c)
) checksums
);
fp "revision=%s\n" (string_of_revision revision);
Option.may (fp "format=%s\n") format;
fp "size=%Ld\n" size;
Option.may (fp "compressed_size=%Ld\n") compressed_size;
Option.may (fp "expand=%s\n") expand;
Option.may (fp "lvexpand=%s\n") lvexpand;
let format_notes notes =
String.concat "\n " (String.nsplit "\n" notes) in
List.iter (
fun (lang, notes) ->
match lang with
| "" -> fp "notes=%s\n" (format_notes notes)
| lang -> fp "notes[%s]=%s\n" lang (format_notes notes)
) notes;
(match aliases with
| None -> ()
| Some l -> fp "aliases=%s\n" (String.concat " " l)
);
if hidden then fp "hidden=true\n";
fp "\n"

View File

@@ -1,26 +0,0 @@
(* virt-builder
* Copyright (C) 2013 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
val get_index : downloader:Downloader.t -> sigchecker:Sigchecker.t -> ?template:bool -> Sources.source -> Index.index
(** [get_index download sigchecker template source] will parse the source
index file into an index entry list. If the template flag is set to
true, the parser will be less picky about missing values. *)
val write_entry : out_channel -> (string * Index.entry) -> unit
(** [write_entry chan entry] writes the index entry to the chan output
stream.*)

View File

@@ -1,130 +0,0 @@
(* builder
* Copyright (C) 2017 SUSE Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
(* This file tests the Index_parser module. *)
open Printf
open OUnit2
open Std_utils
open Unix_utils
open Tools_utils
let tmpdir =
let tmpdir = Mkdtemp.temp_dir "guestfs-tests." in
rmdir_on_exit tmpdir;
tmpdir
let dummy_sigchecker = Sigchecker.create ~gpg:"gpg"
~check_signature:false
~gpgkey:Utils.No_Key
~tmpdir
let dummy_downloader = Downloader.create ~curl:"do-not-use-curl"
~cache:None ~tmpdir
(* Utils. *)
let write_entries file entries =
let chan = open_out (tmpdir // file) in
List.iter (Index_parser.write_entry chan) entries;
close_out chan
let read_file file =
read_whole_file (tmpdir // file)
let parse_file file =
let source = { Sources.name = "input";
uri = tmpdir // file;
gpgkey = Utils.No_Key;
proxy = Curl.SystemProxy;
format = Sources.FormatNative } in
let entries = Index_parser.get_index ~downloader:dummy_downloader
~sigchecker:dummy_sigchecker
source in
List.map (
fun (id, e) -> (id, { e with Index.file_uri = Filename.basename e.Index.file_uri })
) entries
let format_entries entries =
let format_entry entry =
write_entries "out" [entry];
read_file "out" in
List.map format_entry entries
let assert_equal_string = assert_equal ~printer:(fun x -> sprintf "\"%s\"" x)
let assert_equal_list formatter =
let printer = (
fun x -> "(" ^ (String.escaped (String.concat "," (formatter x))) ^ ")"
) in
assert_equal ~printer
let test_write_complete ctx =
let entry =
("test-id", { Index.printable_name = Some "test_name";
osinfo = Some "osinfo_data";
file_uri = "image_path";
arch = Index.Arch "test_arch";
signature_uri = None;
checksums = Some [Checksums.SHA512 "512checksum"];
revision = Utils.Rev_int 42;
format = Some "qcow2";
size = Int64.of_int 123456;
compressed_size = Some (Int64.of_int 12345);
expand = Some "/dev/sda1";
lvexpand = Some "/some/lv";
notes = [ ("", "Notes split\non several lines\n\n with starting space ") ];
hidden = false;
aliases = Some ["alias1"; "alias2"];
sigchecker = dummy_sigchecker;
proxy = Curl.SystemProxy }) in
write_entries "out" [entry];
let actual = read_file "out" in
let expected = "[test-id]
name=test_name
osinfo=osinfo_data
file=image_path
arch=test_arch
checksum[sha512]=512checksum
revision=42
format=qcow2
size=123456
compressed_size=12345
expand=/dev/sda1
lvexpand=/some/lv
notes=Notes split
on several lines
with starting space
aliases=alias1 alias2
" in
assert_equal_string expected actual;
let parsed_entries = parse_file "out" in
assert_equal_list format_entries [entry] parsed_entries
let suite =
"builder Index_parser" >:::
[
"write.complete" >:: test_write_complete;
]
let () =
run_test_tt_main suite

View File

@@ -1,41 +0,0 @@
(* virt-builder
* Copyright (C) 2013-2019 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
open Std_utils
open Tools_utils
type sections = section list
and section = string * fields (* [name] + fields *)
and fields = field list
and field = string * string option * string (* key + subkey + value *)
(* Types returned by the C index parser. *)
type c_sections = c_section array
and c_section = string * c_fields (* [name] + fields *)
and c_fields = field array
(* Calls yyparse in the C code. *)
external parse_index : prog:string -> error_suffix:string -> string -> c_sections = "virt_builder_parse_index"
let read_ini ?(error_suffix = "") file =
let sections = parse_index ~prog ~error_suffix file in
let sections = Array.to_list sections in
List.map (
fun (n, fields) ->
n, Array.to_list fields
) sections

View File

@@ -1,24 +0,0 @@
(* virt-builder
* Copyright (C) 2013-2019 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
type sections = section list
and section = string * fields (* [name] + fields *)
and fields = field list
and field = string * string option * string (* key + subkey + value *)
val read_ini : ?error_suffix:string -> string -> sections

View File

@@ -1,57 +0,0 @@
(* virt-builder
* Copyright (C) 2013-2019 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
open Std_utils
open Tools_utils
let re_locale =
PCRE.compile ~caseless:true "^([a-z]+)(_([a-z]+))?(\\.([a-z0-9-]+))?(@([a-z]+))?$"
let split_locale loc =
let l = ref [] in
if PCRE.matches re_locale loc then (
let match_or_empty n = try PCRE.sub n with Not_found -> "" in
let lang = PCRE.sub 1 in
let territory = match_or_empty 3 in
(match territory with
| "" -> ()
| territory -> List.push_front (lang ^ "_" ^ territory) l);
List.push_front lang l;
);
List.push_front "" l;
List.rev !l
let languages () =
match Setlocale.setlocale Setlocale.LC_MESSAGES None with
| None -> [""]
| Some locale -> split_locale locale
let find_notes languages notes =
let notes = List.fold_left (
fun acc lang ->
let res = List.filter (
fun (langkey, _) ->
match langkey with
| "C" -> lang = ""
| langkey -> langkey = lang
) notes in
match res with
| (_, noteskey) :: _ -> noteskey :: acc
| [] -> acc
) [] languages in
List.rev notes

View File

@@ -1,21 +0,0 @@
(* virt-builder
* 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.
*)
val languages : unit -> string list
val find_notes : string list -> (string * string) list -> string list

View File

@@ -1,7 +0,0 @@
[libguestfs.org]
uri=http://builder.libguestfs.org/index.asc
gpgkey=file://@SYSCONFDIR@/xdg/virt-builder/repos.d/libguestfs.gpg
[archive.libguestfs.org]
uri=http://archive.libguestfs.org/builder/index.asc
gpgkey=file://@SYSCONFDIR@/xdg/virt-builder/repos.d/libguestfs.gpg

View File

@@ -1,64 +0,0 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.14 (GNU/Linux)
mQINBE6UMMEBEADM811hfTulaF4JpkVpAI10FImyb4ArvOiu8NdcUwTFo+cyWno3
U85B86H1Bsk/LgLTYtthSrTgsCtdxy+i5OaMjxZDIwKQ2+IYI3FCn9T3Mn28Idyh
kLHzrO9ph0Dv0BNfrlDZhQEC53aAFe/QxN7+A49BNBV7D1VAOOCsHjxMEDzcZkCa
oCrtXw1aNm2vkkj5ukbfukHAyLcQL7kow0qKPSVa1G4lfQP0WiG259Ydy+sUmbVb
TGdb6MEC84PQRDuw6/ZeoV04tn7ZNtQEMOS0uiciHOGfr2hBxQf9VIPNrHg42yaL
dOv51D99GuaxZ9E0HSoH/RwB1oXgd6rFdqVNYaBIQnnkwJANUEeGBArtIOZNCADT
Bt8vkSDm+lLEAFS+V8CACyW/LMIrGCvLdHeqtoAv0GDVyR2GPxldYfdtEmCUMWcb
Jlf71V9iAse2gUdoiHp5FfpGMkA5j7idKuxIws11XxRZJXXbBqiBqmVEAQ/v0m6p
kdo0MYTHydmecLuUK2bAGhpysfX97EfTSrxfrYphYWjTfKRD9GrADeZNfuz1DbKs
7LSqVaQJSjQrfgAwcnZLRaU0V4P5zxiz50gz1Aj3AZRL+Y3meZenzZTXcLFdnusg
wUfhhCuL3tluMtEh6tznumyxb43WO1yLwj6J6LtveiuJN1Z+KSQ6OieZcwARAQAB
tCVSaWNoYXJkIFcuTS4gSm9uZXMgPHJpY2hAYW5uZXhpYS5vcmc+iQI4BBMBAgAi
BQJOlDDBAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRCRc49z4bdooHQY
D/wJLklSZNyXIW+rG5sUbg7j9cTIF5p/lB9kI2yx6KodJp/2knKyvnmzz0gBw/OE
HL4E4UW26oWKo+36I8wkBnuGa6UtANeITcJqFE19VpHEXHsxre64jNQnO8/w748W
1ROW+Ry43xmrlRWKuCm4oPYUzlp0fq9ATAne8eblfG+NOs8DYuA8xZNQzFaI2kDC
QLD4YoXLoNsP27Koga36b0KwxPFD9tyVZiu9XDH/3hMN7Nb15B66PFr+HcMmQ67G
nUIN5ulcIwj38i40cyaTs1VRheOzTHXE/a6Q2AhMKiKqOoEjQ73/mV7cAVoPtM3o
83Q/8aVKBH0bVRwAeV1tju6b14fqKoG0zNBEcXdlSkht6ScxJYIc/LPUxAMDwgSE
OWshjmeRzKXypBbHn/DP8QVyM2gk5wY+mMSH7MpR0p/hgj+rFO8H9L7pC4dCog3E
qzrYhRN+TaP6MPH3WkOwPH4d4IfQRFnHp+VPYPijKEiLrUl/o8k3DyAanAPBpJ/x
na4wXAjlFBctOq6g+SrCUiHpwk7b2YNwGgr5Vl3GmZELzK/G8gg3uJYKQ9Bpv16t
WWOz+IFiOFa0UULeo0QPmFAIMZiDojNsY1SwBKB3ZL1YWZezgMdQAbpze/IXoSt7
zxWJoKH2jK7q9mvFiaY12l2YnKuCcegWVAViLxRpBnrbz7QmUmljaGFyZCBXLk0u
IEpvbmVzIDxyam9uZXNAcmVkaGF0LmNvbT6JAjgEEwECACIFAk6UOQsCGwMGCwkI
BwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEJFzj3Pht2igIUYQAKomI0edLakahsUQ
MxOZuhBbXJ4/VWF8bXYChDNPKvJp5nB7fBXujJ+39cIUM5fe2ViO6qSDpFC29imx
F5pPbAqspZBPBkLLiZLji8R42hGarntdtTW0UWSBpq+nC5+G1psrnATI3uXGNxKQ
R99c5HoMY7dBC2Y8TCGE64NINZ/XVh472s6IGLPn8MTn26YdRKC9BrVkCFMP2OBr
6D4IprnyTAWAzb68ew20QmyWO+NBi9MplaDNQVl8PIOgfpyWlkgX1z9m67pcSDkw
46hksp0yuOD1VwR4iVZ2/CmIsGRUlx41vWD6BIp9KxKyDIU1CYTRhq72dahHsl/8
BjCndV5PO0GphqfCzmCv4DXjUwmrMTbH/GFnt5rfwcMcXUgcK0vV9vQ2SOU56Zd1
fb27ZCFJKZc0Fu8krwFldCp/NYILf6ogUL/C1hfuCGSSuyDVY16Gg3dla1x+6zpF
asnWQlaw8xT5LlMWvTZs5WsoSVHu7dVZWlgxINP++hlZrTz/S8l38yyQ15YFFl3W
9M7dzkegOeDTPfx6B89WgfvfJjA/D0/FYxxWPXEtrn9DlJ4daEJqNsrvfLErz9R8
4IQmfmhR93j+rdotner+6keC/wVByEfbW1wmXtmFKXQ6srdpj8VKRFrvkyXVgepM
DypLgRH2v7lL2kdWhUu2y4EAgrwzuQINBE6UMMEBEADxQxMgUuDrw5GT4tqARTPI
SSdNcUsRxRhVA8srYOyECliE+B3TwcRDFBs+MyPFJVEuX8fi4eGj/AK5t1GHerfk
orUGlz72q4c7LLhkfZrsuJbk2dgkjvldKJnIazQJa6epGLqdsE5RlmSgwedIbtMd
naGJBQH8aKP/Wi1+wUxsm5N3p7+R2WRx48VfpEhYB+Zf/FkFm1Ycjwh57KQ0+OHw
ykf8VfMisxuH30tDxOCV+VptWKfOF2rDNdaNPWhij2YIjhJXRpkuRR+1PpI4jLaD
JxcVZmG/0zucacupUN2g5OUH59ySU/totD6YMnmp3FONoyF1uIEJo6Vs30npHGkO
XgBo3Pxt7oLJeykLPtdSLgm3cwXIYMWarVsAkKNXitQIVGpVRLeaK373VwmXFqoi
M2SMHeawTUdOORFjpQzkknlJWM1TmUVtHHKt8Pl9+/5+wXKyt2IDdcUkMrB6K5qF
fb7EwVhoI8ehJQK+eeDCjFwCAiwB3iV8JlyW+tEU7JuyXOQlwY1VWm/WqMD8gaRi
rT+RFDFliZ3tQbW2pqUoZBROV5HN4tieDfwxGKCvk6Tsdb30zA9DPQp93+238bYf
312sg9R+CD0AqxoxFG5FJu4HShcPRrPnYtRZqKRe40GDWvBEArXZprwL1qrP+Kl/
mRrEQpxAGIoFG8HbVvD3EQARAQABiQIfBBgBAgAJBQJOlDDBAhsMAAoJEJFzj3Ph
t2igSLQP/2uIrAY2CDr0kWBJiD3TztiHy8IdxwUpyTBTebwmAbi44/EvtJfIisrG
YjKIEv/w0E61gO7O1JBG4+IG93W+v9fTT/e39JMyxsYqoZZHUhP11Okx5grDS5b0
O8VXOmXVRMdVNfstRBr10HD9uNDq7ruKD18TxYTwN0GPD4gj1dbHQDR77Tr5cyBs
6Ou5PBOH4r3qcqf/cJUSMeUUu75xLwixux6E7tD2S+t6F07wlWxntUcPtzyAHj20
J89orUC+dT6r6MypBoI0jdJCp9JPGtR7i+fE5Gm4E5+AUSubLPtZGRY9Um2eMoS2
DnQpGOKx1VvsixR/Kw44j2tRAvmYMS4iDKcuZU+nZ+xokAgObILj/b9n/Qe2/fXy
CFdcgSvbm+dV1fZxsdMF/P9OU8aqdT9A9Fv5y+cDMEg4DVnhwMJTxGh/TCkw/H+A
frHEtRc98lSQN5odpITNG17mG6JOdHM+wA57qHH0uy4+5RsbyAJahcdBcmObK/RF
i4WZlThpbHftX5O/LH98aYQ2fJayIxv1EAjzOBOQ0MfBHI0KCJR1pysEisX28sJA
Ic73gnJJ3BLZbqfBRgxjNMNroxC+5Tw6uPGFHa3YnuIAxxw0HcDVZ9vnTWBWFPGw
ZvXkQ3FVJwZoLmHw47vvlVpLD/4gi1SuHWieRvZ+UdDq00E348pm
=neBW
-----END PGP PUBLIC KEY BLOCK-----

View File

@@ -1,156 +0,0 @@
(* virt-builder
* Copyright (C) 2013 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
open Std_utils
open Tools_utils
open Common_gettext.Gettext
open Printf
type format =
| Short
| Long
| Json
let list_formats = [ "short"; "long"; "json" ]
let list_format_of_string = function
| "short" -> Short
| "long" -> Long
| "json" -> Json
| fmt -> invalid_arg fmt
let rec list_entries ~list_format ~sources index =
match list_format with
| Short -> list_entries_short index
| Long -> list_entries_long ~sources index
| Json -> list_entries_json ~sources index
and list_entries_short index =
List.iter (
fun (name, { Index.printable_name; arch; hidden }) ->
if not hidden then (
printf "%-24s" name;
printf " %-10s" (Index.string_of_arch arch);
Option.may (printf " %s") printable_name;
printf "\n"
)
) index
and list_entries_long ~sources index =
let langs = Languages.languages () in
List.iter (
fun { Sources.uri; gpgkey } ->
printf (f_"Source URI: %s\n") uri;
(match gpgkey with
| Utils.No_Key -> ()
| Utils.Fingerprint fp ->
printf (f_"Fingerprint: %s\n") fp;
| Utils.KeyFile kf ->
printf (f_"Key: %s\n") kf;
);
printf "\n"
) sources;
List.iter (
fun (name, { Index.printable_name; arch; size; compressed_size;
notes; aliases; hidden }) ->
if not hidden then (
printf "%-24s %s\n" "os-version:" name;
Option.may (printf "%-24s %s\n" (s_"Full name:")) printable_name;
printf "%-24s %s\n" (s_"Architecture:") (Index.string_of_arch arch);
printf "%-24s %s\n" (s_"Minimum/default size:") (human_size size);
Option.may (fun size ->
printf "%-24s %s\n" (s_"Download size:") (human_size size)
) compressed_size;
Option.may (
fun l -> printf "%-24s %s\n" (s_"Aliases:") (String.concat " " l)
) aliases;
let notes = Languages.find_notes langs notes in
(match notes with
| notes :: _ ->
printf "\n";
printf (f_"Notes:\n\n%s\n") notes
| [] -> ()
);
printf "\n"
)
) index
and list_entries_json ~sources index =
let json_sources =
List.map (
fun { Sources.uri; gpgkey } ->
let item = [ "uri", JSON.String uri ] in
let item =
match gpgkey with
| Utils.No_Key -> item
| Utils.Fingerprint fp ->
("fingerprint", JSON.String fp) :: item
| Utils.KeyFile kf ->
("key", JSON.String kf) :: item in
JSON.Dict item
) sources in
let json_templates =
List.map (
fun (name, { Index.printable_name; arch; size; compressed_size;
notes; aliases; osinfo; hidden }) ->
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 (Index.string_of_arch arch)) :: item in
let item = ("size", JSON.Int 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 1L;
"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

@@ -1,33 +0,0 @@
(* virt-builder
* Copyright (C) 2013 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
type format =
| Short
| Long
| Json
val list_formats : string list
(** The string representation of the available formats. *)
val list_format_of_string : string -> format
(** Convert from a string to the corresponding format.
Throw [Invalid_argument] if the string does not match any
valid format. *)
val list_entries : list_format:format -> sources:Sources.source list -> Index.index -> unit

View File

@@ -1,3 +0,0 @@
[opensuse.org]
uri=http://download.opensuse.org/repositories/Virtualization:/virt-builder-images/images/index
gpgkey=file://@SYSCONFDIR@/xdg/virt-builder/repos.d/opensuse.gpg

View File

@@ -1,21 +0,0 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.5 (GNU/Linux)
mQENBFImAl0BCACkjaXGvVLHBGTVXVP0khtpUVHqFvCRtaIIMHaX/5oTr3nyehDQ
Ex9VLsSRcNa0QxtnCHFRQzjWWqe+i6pBginnSjucgmjnIKyJsF4l6R+rwAiinHQX
C4s6Lqg/wH9xDPRBrMYFqlc/7MVf0Glhk1+lAxgQjolMt+5AbbrWlBbwc/i+++zl
ES3MaeH8aiwup/ogjhmk0SbCQQ/ib21p3XWBwx2oz/KM6Voq9tKDvMczjzNRY3ZT
6Di3FsUSKI7kgljiNiuN+675YwqEqxWEJgdE5a7Zb67giH1Ik08b5wQiF5jSAICD
DxW7/ibWBvZJnqhqQT2xJpLC5VaJqwkN8o83ABEBAAG0PlZpcnR1YWxpemF0aW9u
IE9CUyBQcm9qZWN0IDxWaXJ0dWFsaXphdGlvbkBidWlsZC5vcGVuc3VzZS5vcmc+
iQE7BBMBAgAmBQJSJgJdAhsDBQkEHrAABgsJCAcDAgQVAggDBBYCAwECHgECF4AA
CgkQoZP7tXIXT8ITnwf3SVUUoVjVLFCjhIxdet8BL011cJDwr9TwKEQfq4Ybsq5L
5Y1/Zk86rTzrVOZrODLwNRIC3fMuegZV5f85KMggXu37Di+UvX+dQW9v1hte+hAT
+gsqb60kOnE/Yacgkb6D3xIzRudAB2q/xfvHl/hgfn416yGI8NvntT7n4Hk9wT28
9JSFkun0uaessg77aXlAdsqHwdugm9hELeva89OoYoiZ4d9r4ScTMSj0UkNgnh7g
CyIScZHYqiiOeosUtAX9u1PyUFfFsg9s5snfud7aF48EfXU0RTtZAGKtG4GPDv3q
bYc5TJ2pQzs9y5Bk/jAMR/QQw8CKglBsn1cjYkKViEYEExECAAYFAlImAl0ACgkQ
OzARt2udZSO5yACgr6Ei7QZ+PAmg4Mr5db+4M3aepAEAniU33RaTKBCGkwQi6kHr
4VaII2/E
=l8DH
-----END PGP PUBLIC KEY BLOCK-----

View File

@@ -1,76 +0,0 @@
(* virt-builder
* Copyright (C) 2017 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
open Std_utils
open Tools_utils
open Osinfo_config
let rec fold fn base =
let locations =
(* (1) Try the shared osinfo directory, using either the
* $OSINFO_SYSTEM_DIR envvar or its default value.
*)
let dir =
try Sys.getenv "OSINFO_SYSTEM_DIR"
with Not_found -> "/usr/share/osinfo" in
((dir // "os"), read_osinfo_db_three_levels) ::
(* (2) Try the libosinfo directory, using the newer three-directory
* layout ($LIBOSINFO_DB_PATH / "os" / $group-ID / [file.xml]).
*)
let path = Osinfo_config.libosinfo_db_path // "os" in
(path, read_osinfo_db_three_levels) ::
(* (3) Try the libosinfo directory, using the old flat directory
* layout ($LIBOSINFO_DB_PATH / "oses" / [file.xml]).
*)
let path = Osinfo_config.libosinfo_db_path // "oses" in
(path, read_osinfo_db_flat) :: [] in
let files =
List.flatten (
List.filter_map (
fun (path, f) ->
if is_directory path then Some (f path)
(* This is not an error: RHBZ#948324. *)
else None
) locations
) in
List.fold_left fn base files
and read_osinfo_db_three_levels path =
debug "osinfo: loading 3-level-directories database from %s" path;
let entries = Array.to_list (Sys.readdir path) in
let entries = List.map ((//) path) entries in
(* Iterate only on directories. *)
let entries = List.filter is_directory entries in
List.flatten (List.map read_osinfo_db_directory entries)
and read_osinfo_db_flat path =
debug "osinfo: loading flat database from %s" path;
read_osinfo_db_directory path
and read_osinfo_db_directory path =
let entries = Sys.readdir path in
let entries = Array.to_list entries in
let entries = List.filter (fun x -> Filename.check_suffix x ".xml") entries in
let entries = List.map ((//) path) entries in
let entries = List.filter is_regular_file entries in
entries

View File

@@ -1,22 +0,0 @@
(* virt-builder
* Copyright (C) 2017 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.
*)
val fold : ('a -> string -> 'a) -> 'a -> 'a
(** [fold f base] folds function [f] over every file in the
osinfo-db/libosinfo database of OS definitions.
*)

View File

@@ -1,21 +0,0 @@
(* virt-builder
* Copyright (C) 2017 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.
*)
val libosinfo_db_path : string
(** The path to the libosinfo database. Note the path is generated
at runtime by [Makefile.am]. *)

View File

@@ -1,42 +0,0 @@
(* virt-builder
* 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.
*)
open Std_utils
open Tools_utils
let xdg_cache_home =
try Some (Sys.getenv "XDG_CACHE_HOME" // "virt-builder")
with Not_found ->
try Some (Sys.getenv "HOME" // ".cache" // "virt-builder")
with Not_found ->
None (* no cache directory *)
let xdg_config_home () =
try Some (Sys.getenv "XDG_CONFIG_HOME" // prog)
with Not_found ->
try Some (Sys.getenv "HOME" // ".config" // prog)
with Not_found ->
None (* no config directory *)
let xdg_config_dirs () =
let dirs =
try Sys.getenv "XDG_CONFIG_DIRS"
with Not_found -> "/etc/xdg" in
let dirs = String.nsplit ":" dirs in
let dirs = List.filter (fun x -> x <> "") dirs in
List.map (fun x -> x // prog) dirs

View File

@@ -1,28 +0,0 @@
(* virt-builder
* Copyright (C) 2014-2019 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.
*)
val xdg_cache_home : string option
(** [$XDG_CACHE_HOME/virt-builder] or [$HOME/.cache/virt-builder] or [None]. *)
val xdg_config_home : unit -> string option
(** [$XDG_CONFIG_HOME/prog] or [$HOME/.config/prog] or [None]. *)
val xdg_config_dirs : unit -> string list
(** [$XDG_CONFIG_DIRS] (which is a colon-separated path), split. Empty
elements are removed from the list. If the environment variable
is not set [["/etc/xdg"]] is returned instead. *)

View File

@@ -1,692 +0,0 @@
/* virt-builder
* Copyright (C) 2013 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <pthread.h>
#include <caml/alloc.h>
#include <caml/fail.h>
#include <caml/memory.h>
#include <caml/mlvalues.h>
#include <caml/unixsupport.h>
#include "guestfs.h"
#include "guestfs-utils.h"
#include "ignore-value.h"
#if HAVE_LIBLZMA
#include <lzma.h>
#endif
#if defined (HAVE_LIBLZMA) && \
defined (HAVE_LZMA_INDEX_STREAM_FLAGS) && \
defined (HAVE_LZMA_INDEX_STREAM_PADDING)
#define PARALLEL_XZCAT 1
#else
#define PARALLEL_XZCAT 0
#endif
extern value virt_builder_using_parallel_xzcat (value unitv);
value
virt_builder_using_parallel_xzcat (value unitv)
{
return PARALLEL_XZCAT ? Val_true : Val_false;
}
#if PARALLEL_XZCAT
static void pxzcat (value filenamev, value outputfilev, unsigned nr_threads);
#endif /* PARALLEL_XZCAT */
extern value virt_builder_pxzcat (value inputfilev, value outputfilev);
value
virt_builder_pxzcat (value inputfilev, value outputfilev)
{
CAMLparam2 (inputfilev, outputfilev);
#if PARALLEL_XZCAT
/* Parallel implementation of xzcat (pxzcat). */
/* XXX Make number of threads configurable? */
long i;
unsigned nr_threads;
i = sysconf (_SC_NPROCESSORS_ONLN);
if (i <= 0) {
perror ("could not get number of cores");
i = 1;
}
nr_threads = (unsigned) i;
/* NB: This might throw an exception if something fails. If it
* does, this function won't return as a regular C function.
*/
pxzcat (inputfilev, outputfilev, nr_threads);
#else /* !PARALLEL_XZCAT */
/* Fallback: use regular xzcat. */
int fd;
pid_t pid;
int status;
fd = open (String_val (outputfilev), O_WRONLY|O_CREAT|O_TRUNC|O_NOCTTY, 0666);
if (fd == -1)
unix_error (errno, (char *) "open", outputfilev);
pid = fork ();
if (pid == -1) {
const int err = errno;
close (fd);
unix_error (err, (char *) "fork", Nothing);
}
if (pid == 0) { /* child - run xzcat */
dup2 (fd, 1);
execlp (XZCAT, XZCAT, String_val (inputfilev), NULL);
perror (XZCAT);
_exit (EXIT_FAILURE);
}
close (fd);
if (waitpid (pid, &status, 0) == -1)
unix_error (errno, (char *) "waitpid", Nothing);
if (!WIFEXITED (status) || WEXITSTATUS (status) != 0)
caml_failwith (XZCAT " program failed, see earlier error messages");
#endif /* !PARALLEL_XZCAT */
CAMLreturn (Val_unit);
}
#if PARALLEL_XZCAT
#define DEBUG 0
#if DEBUG
#define debug(fs,...) fprintf (stderr, "pxzcat: debug: " fs "\n", ## __VA_ARGS__)
#else
#define debug(fs,...) /* nothing */
#endif
/* Size of buffers used in decompression loop. */
#define BUFFER_SIZE (64*1024)
#define XZ_HEADER_MAGIC "\xfd" "7zXZ\0"
#define XZ_HEADER_MAGIC_LEN 6
static int check_header_magic (int fd);
static lzma_index *parse_indexes (value filenamev, int fd);
static void iter_blocks (lzma_index *idx, unsigned nr_threads, value filenamev, int fd, value outputfilev, int ofd);
static void
pxzcat (value filenamev, value outputfilev, unsigned nr_threads)
{
int fd, ofd;
uint64_t size;
lzma_index *idx;
/* Open the file. */
fd = open (String_val (filenamev), O_RDONLY);
if (fd == -1)
unix_error (errno, (char *) "open", filenamev);
guestfs_int_fadvise_noreuse (fd);
guestfs_int_fadvise_random (fd);
/* Check file magic. */
if (!check_header_magic (fd)) {
close (fd);
caml_invalid_argument ("input file is not an xz file");
}
/* Read and parse the indexes. */
idx = parse_indexes (filenamev, fd);
/* Get the file uncompressed size, create the output file. */
size = lzma_index_uncompressed_size (idx);
debug ("uncompressed size = %" PRIu64 " bytes", size);
/* Avoid annoying ext4 auto_da_alloc which causes a flush on close
* unless we are very careful about not truncating a regular file
* from non-zero size to zero size. (Thanks Eric Sandeen)
*/
ofd = open (String_val (outputfilev), O_WRONLY|O_CREAT|O_NOCTTY, 0644);
if (ofd == -1) {
const int err = errno;
close (fd);
unix_error (err, (char *) "open", outputfilev);
}
guestfs_int_fadvise_random (ofd);
if (ftruncate (ofd, 1) == -1) {
const int err = errno;
close (fd);
unix_error (err, (char *) "ftruncate", outputfilev);
}
if (lseek (ofd, 0, SEEK_SET) == -1) {
const int err = errno;
close (fd);
unix_error (err, (char *) "lseek", outputfilev);
}
if (write (ofd, "\0", 1) == -1) {
const int err = errno;
close (fd);
unix_error (err, (char *) "write", outputfilev);
}
if (ftruncate (ofd, size) == -1) {
const int err = errno;
close (fd);
unix_error (err, (char *) "ftruncate", outputfilev);
}
/* Iterate over blocks. */
iter_blocks (idx, nr_threads, filenamev, fd, outputfilev, ofd);
lzma_index_end (idx, NULL);
if (close (fd) == -1)
unix_error (errno, (char *) "close", filenamev);
if (close (ofd) == -1)
unix_error (errno, (char *) "close", outputfilev);
}
static int
check_header_magic (int fd)
{
char buf[XZ_HEADER_MAGIC_LEN];
if (lseek (fd, 0, SEEK_SET) == -1)
return 0;
if (read (fd, buf, XZ_HEADER_MAGIC_LEN) != XZ_HEADER_MAGIC_LEN)
return 0;
if (memcmp (buf, XZ_HEADER_MAGIC, XZ_HEADER_MAGIC_LEN) != 0)
return 0;
return 1;
}
/* For explanation of this function, see src/xz/list.c:parse_indexes
* in the xz sources.
*/
static lzma_index *
parse_indexes (value filenamev, int fd)
{
lzma_ret r;
off_t pos, index_size;
CLEANUP_FREE uint8_t *footer = NULL;
CLEANUP_FREE uint8_t *header = NULL;
lzma_stream_flags footer_flags;
lzma_stream_flags header_flags;
lzma_stream strm = LZMA_STREAM_INIT;
ssize_t n;
lzma_index *combined_index = NULL;
lzma_index *this_index = NULL;
lzma_vli stream_padding = 0;
size_t nr_streams = 0;
CLEANUP_FREE uint8_t *buf = NULL;
footer = malloc (sizeof (uint8_t) * LZMA_STREAM_HEADER_SIZE);
header = malloc (sizeof (uint8_t) * LZMA_STREAM_HEADER_SIZE);
buf = malloc (sizeof (uint8_t) * BUFSIZ);
if (footer == NULL || header == NULL || buf == NULL)
caml_raise_out_of_memory ();
/* Check file size is a multiple of 4 bytes. */
pos = lseek (fd, 0, SEEK_END);
if (pos == (off_t) -1)
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");
/* Jump backwards through the file identifying each stream. */
while (pos > 0) {
debug ("looping through streams: pos = %" PRIu64, (uint64_t) pos);
if (pos < LZMA_STREAM_HEADER_SIZE)
caml_invalid_argument ("corrupted xz file");
if (lseek (fd, -LZMA_STREAM_HEADER_SIZE, SEEK_CUR) == -1)
unix_error (errno, (char *) "lseek", filenamev);
if (read (fd, footer, LZMA_STREAM_HEADER_SIZE) != LZMA_STREAM_HEADER_SIZE)
unix_error (errno, (char *) "read", filenamev);
/* Skip stream padding. */
if (footer[8] == 0 && footer[9] == 0 &&
footer[10] == 0 && footer[11] == 0) {
stream_padding += 4;
pos -= 4;
continue;
}
pos -= LZMA_STREAM_HEADER_SIZE;
nr_streams++;
debug ("decode stream footer at pos = %" PRIu64, (uint64_t) pos);
/* Does the stream footer look reasonable? */
r = lzma_stream_footer_decode (&footer_flags, footer);
if (r != LZMA_OK) {
fprintf (stderr, "invalid stream footer - error %u\n", r);
caml_invalid_argument ("invalid stream footer");
}
debug ("backward_size = %" PRIu64, (uint64_t) footer_flags.backward_size);
index_size = footer_flags.backward_size;
if (pos < index_size + LZMA_STREAM_HEADER_SIZE)
caml_invalid_argument ("invalid stream footer");
pos -= index_size;
debug ("decode index at pos = %" PRIu64, (uint64_t) pos);
/* Seek backwards to the index of this stream. */
if (lseek (fd, pos, SEEK_SET) == -1)
unix_error (errno, (char *) "lseek", filenamev);
/* Decode the index. */
r = lzma_index_decoder (&strm, &this_index, UINT64_MAX);
if (r != LZMA_OK) {
fprintf (stderr, "invalid stream index - error %u\n", r);
caml_invalid_argument ("invalid stream index");
}
do {
strm.avail_in = index_size;
if (strm.avail_in > BUFSIZ)
strm.avail_in = BUFSIZ;
n = read (fd, buf, strm.avail_in);
if (n == -1)
unix_error (errno, (char *) "read", filenamev);
index_size -= strm.avail_in;
strm.next_in = buf;
r = lzma_code (&strm, LZMA_RUN);
} while (r == LZMA_OK);
if (r != LZMA_STREAM_END) {
fprintf (stderr, "could not parse index - error %u\n", r);
caml_invalid_argument ("could not parse index");
}
pos -= lzma_index_total_size (this_index) + LZMA_STREAM_HEADER_SIZE;
debug ("decode stream header at pos = %" PRIu64, (uint64_t) pos);
/* Read and decode the stream header. */
if (lseek (fd, pos, SEEK_SET) == -1)
unix_error (errno, (char *) "lseek", filenamev);
if (read (fd, header, LZMA_STREAM_HEADER_SIZE) != LZMA_STREAM_HEADER_SIZE)
unix_error (errno, (char *) "read stream header", filenamev);
r = lzma_stream_header_decode (&header_flags, header);
if (r != LZMA_OK) {
fprintf (stderr, "invalid stream header - error %u\n", r);
caml_invalid_argument ("invalid stream header");
}
/* Header and footer of the stream should be equal. */
r = lzma_stream_flags_compare (&header_flags, &footer_flags);
if (r != LZMA_OK) {
fprintf (stderr, "header and footer of stream are not equal - error %u\n",
r);
caml_invalid_argument ("header and footer of stream are not equal");
}
/* Store the decoded stream flags in this_index. */
r = lzma_index_stream_flags (this_index, &footer_flags);
if (r != LZMA_OK) {
fprintf (stderr, "cannot read stream_flags from index - error %u\n", r);
caml_invalid_argument ("cannot read stream_flags from index");
}
/* Store the amount of stream padding so far. Needed to calculate
* compressed offsets correctly in multi-stream files.
*/
r = lzma_index_stream_padding (this_index, stream_padding);
if (r != LZMA_OK) {
fprintf (stderr, "cannot set stream_padding in index - error %u\n", r);
caml_invalid_argument ("cannot set stream_padding in index");
}
if (combined_index != NULL) {
r = lzma_index_cat (this_index, combined_index, NULL);
if (r != LZMA_OK) {
fprintf (stderr, "cannot combine indexes - error %u\n", r);
caml_invalid_argument ("cannot combine indexes");
}
}
combined_index = this_index;
this_index = NULL;
}
lzma_end (&strm);
return combined_index;
}
struct global_state {
/* Current iterator. Threads update this, but it is protected by a
* mutex, and each thread takes a copy of it when working on it.
*/
lzma_index_iter iter;
lzma_bool iter_finished;
pthread_mutex_t iter_mutex;
/* Note that all threads are accessing these fds, so you have
* to use pread/pwrite instead of lseek!
*/
/* Input file. */
const char *filename;
int fd;
/* Output file. */
const char *outputfile;
int ofd;
};
struct per_thread_state {
unsigned thread_num;
struct global_state *global;
int status;
};
/* Create threads to iterate over the blocks and uncompress. */
static void *worker_thread (void *vp);
static void
iter_blocks (lzma_index *idx, unsigned nr_threads,
value filenamev, int fd, value outputfilev, int ofd)
{
struct global_state global;
CLEANUP_FREE struct per_thread_state *per_thread = NULL;
CLEANUP_FREE pthread_t *thread = NULL;
unsigned u, nr_errors;
int err;
void *status;
per_thread = malloc (sizeof (struct per_thread_state) * nr_threads);
thread = malloc (sizeof (pthread_t) * nr_threads);
if (per_thread == NULL || thread == NULL)
caml_raise_out_of_memory ();
lzma_index_iter_init (&global.iter, idx);
global.iter_finished = 0;
err = pthread_mutex_init (&global.iter_mutex, NULL);
if (err != 0)
unix_error (err, (char *) "pthread_mutex_init", Nothing);
global.filename = String_val (filenamev);
global.fd = fd;
global.outputfile = String_val (outputfilev);
global.ofd = ofd;
for (u = 0; u < nr_threads; ++u) {
per_thread[u].thread_num = u;
per_thread[u].global = &global;
}
/* Start the 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, (char *) "pthread_create", Nothing);
}
/* Wait for the threads to exit. */
nr_errors = 0;
for (u = 0; u < nr_threads; ++u) {
err = pthread_join (thread[u], &status);
if (err != 0) {
fprintf (stderr, "pthread_join (%u): %s\n", u, strerror (err));
nr_errors++;
}
if (*(int *)status == -1)
nr_errors++;
}
if (nr_errors > 0)
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)
{
struct per_thread_state *state = vp;
struct global_state *global = state->global;
lzma_index_iter iter;
int err;
off_t position, oposition;
CLEANUP_FREE uint8_t *header = NULL;
ssize_t n;
lzma_block block;
CLEANUP_FREE lzma_filter *filters = NULL;
lzma_ret r;
lzma_stream strm = LZMA_STREAM_INIT;
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);
if (err != 0) abort ();
iter_finished = global->iter_finished;
if (!iter_finished) {
iter_finished = global->iter_finished =
lzma_index_iter_next (&global->iter, LZMA_INDEX_ITER_NONEMPTY_BLOCK);
if (!iter_finished)
/* Take a local copy of this iterator since another thread will
* update the global version.
*/
iter = global->iter;
}
err = pthread_mutex_unlock (&global->iter_mutex);
if (err != 0) abort ();
if (iter_finished)
break;
/* Read the block header. Start by reading a single byte which
* tell us how big the block header is.
*/
position = iter.block.compressed_file_offset;
n = pread (global->fd, header, 1, position);
if (n == 0) {
fprintf (stderr,
"%s: read: unexpected end of file reading block header byte\n",
global->filename);
return &state->status;
}
if (n == -1) {
perror (String_val (global->filename));
return &state->status;
}
position++;
if (header[0] == '\0') {
fprintf (stderr,
"%s: read: unexpected invalid block in file, header[0] = 0\n",
global->filename);
return &state->status;
}
block.version = 0;
block.check = iter.stream.flags->check;
block.filters = filters;
block.header_size = lzma_block_header_size_decode (header[0]);
/* Now read and decode the block header. */
n = pread (global->fd, &header[1], block.header_size-1, position);
if (n >= 0 && n != (ssize_t) block.header_size-1) {
fprintf (stderr,
"%s: read: unexpected end of file reading block header\n",
global->filename);
return &state->status;
}
if (n == -1) {
perror (global->filename);
return &state->status;
}
position += n;
r = lzma_block_header_decode (&block, NULL, header);
if (r != LZMA_OK) {
fprintf (stderr, "%s: invalid block header (error %u)\n",
global->filename, r);
return &state->status;
}
/* What this actually does is it checks that the block header
* matches the index.
*/
r = lzma_block_compressed_size (&block, iter.block.unpadded_size);
if (r != LZMA_OK) {
fprintf (stderr,
"%s: cannot calculate compressed size (error %u)\n",
global->filename, r);
return &state->status;
}
/* Where we will start writing to. */
oposition = iter.block.uncompressed_file_offset;
/* Read the block data and uncompress it. */
r = lzma_block_decoder (&strm, &block);
if (r != LZMA_OK) {
fprintf (stderr, "%s: invalid block (error %u)\n", global->filename, r);
return &state->status;
}
strm.next_in = NULL;
strm.avail_in = 0;
strm.next_out = outbuf;
strm.avail_out = BUFFER_SIZE;
for (;;) {
lzma_action action = LZMA_RUN;
if (strm.avail_in == 0) {
strm.next_in = buf;
n = pread (global->fd, buf, BUFFER_SIZE, position);
if (n == -1) {
perror (global->filename);
return &state->status;
}
position += n;
strm.avail_in = n;
if (n == 0)
action = LZMA_FINISH;
}
r = lzma_code (&strm, action);
if (strm.avail_out == 0 || r == LZMA_STREAM_END) {
size_t wsz = BUFFER_SIZE - strm.avail_out;
/* Don't write if the block is all zero, to preserve output file
* sparseness. However we have to update oposition.
*/
if (!is_zero ((char *) outbuf, wsz)) {
if (xpwrite (global->ofd, outbuf, wsz, oposition) == -1) {
perror (global->outputfile);
return &state->status;
}
}
oposition += wsz;
strm.next_out = outbuf;
strm.avail_out = BUFFER_SIZE;
}
if (r == LZMA_STREAM_END)
break;
if (r != LZMA_OK) {
fprintf (stderr,
"%s: could not parse block data (error %u)\n",
global->filename, r);
return &state->status;
}
}
lzma_end (&strm);
for (i = 0; filters[i].id != LZMA_VLI_UNKNOWN; ++i)
free (filters[i].options);
}
state->status = 0;
return &state->status;
}
#endif /* PARALLEL_XZCAT */

View File

@@ -1,20 +0,0 @@
(* virt-builder
* Copyright (C) 2013 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
external pxzcat : string -> string -> unit = "virt_builder_pxzcat"
external using_parallel_xzcat : unit -> bool = "virt_builder_using_parallel_xzcat" "noalloc"

View File

@@ -1,34 +0,0 @@
(* virt-builder
* Copyright (C) 2013 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
(** {1 Parallel xzcat (or fall back to regular xzcat).}
Eventually regular xzcat will be able to work in parallel and this
code can go away.
*)
val pxzcat : string -> string -> unit
(** [pxzcat input output] uncompresses the file [input] to the file
[output]. The input and output must both be seekable.
If liblzma was found at compile time, this uses an internal
implementation of parallel xzcat. Otherwise regular xzcat is
used. *)
val using_parallel_xzcat : unit -> bool
(** Returns [true] iff the implementation uses parallel xzcat. *)

View File

@@ -1,583 +0,0 @@
(* virt-builder
* Copyright (C) 2016-2019 SUSE Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
open Std_utils
open Common_gettext.Gettext
open Tools_utils
open Unix_utils
open Getopt.OptionName
open Utils
open JSON_parser
open Xpath_helpers
open Printf
type cmdline = {
gpg : string;
gpgkey : string option;
interactive : bool;
compression : bool;
repo : string;
}
type disk_image_info = {
format : string;
size : int64;
}
let parse_cmdline () =
let gpg = ref "gpg" in
let gpgkey = ref None in
let set_gpgkey arg = gpgkey := Some arg in
let interactive = ref false in
let compression = ref true in
let argspec = [
[ L"gpg" ], Getopt.Set_string ("gpg", gpg), s_"Set GPG binary/command";
[ S 'K'; L"gpg-key" ], Getopt.String ("gpgkey", set_gpgkey),
s_"ID of the GPG key to sign the repo with";
[ S 'i'; L"interactive" ], Getopt.Set interactive, s_"Ask the user about missing data";
[ L"no-compression" ], Getopt.Clear compression, s_"Dont compress the new images in the index";
] in
let args = ref [] in
let anon_fun s = List.push_front s args in
let usage_msg =
sprintf (f_"\
%s: create a repository for virt-builder
virt-builder-repository REPOSITORY_PATH
A short summary of the options is given below. For detailed help please
read the man page virt-builder-repository(1).
")
prog in
let opthandle = create_standard_options argspec ~anon_fun ~machine_readable:true usage_msg in
Getopt.parse opthandle.getopt;
(* Machine-readable mode? Print out some facts about what
* this binary supports.
*)
(match machine_readable () with
| Some { pr } ->
pr "virt-builder-repository\n";
exit 0
| None -> ()
);
(* Dereference options. *)
let args = List.rev !args in
let gpg = !gpg in
let gpgkey = !gpgkey in
let interactive = !interactive in
let compression = !compression in
(* Check options *)
let repo =
match args with
| [repo] -> repo
| [] ->
error (f_"virt-builder-repository /path/to/repo
Use /path/to/repo to point to the repository folder.")
| _ ->
error (f_"too many parameters, only one path to repository is allowed") in
{
gpg = gpg;
gpgkey = gpgkey;
interactive = interactive;
compression = compression;
repo = repo;
}
let do_mv src dest =
let cmd = [ "mv"; src; dest ] in
let r = run_command cmd in
if r <> 0 then
error (f_"moving file %s to %s failed") src dest
let checksums_get_sha512 = function
| None -> None
| Some csums ->
let rec loop = function
| [] -> None
| Checksums.SHA512 csum :: _ -> Some (Checksums.SHA512 csum)
| _ :: rest -> loop rest
in
loop csums
let osinfo_ids = ref None
let rec osinfo_get_short_ids () =
match !osinfo_ids with
| Some ids -> ids
| None ->
osinfo_ids :=
Some (
Osinfo.fold (
fun set filepath ->
let doc = Xml.parse_file filepath in
let xpathctx = Xml.xpath_new_context doc in
let nodes = xpath_get_nodes xpathctx "/libosinfo/os/short-id" in
List.fold_left (
fun set node ->
let id = Xml.node_as_string node in
StringSet.add id set
) set nodes
) StringSet.empty
);
osinfo_get_short_ids ()
let compress_to file outdir =
let outimg = outdir // Filename.basename file ^ ".xz" in
info "Compressing ...";
let cmd = [ "xz"; "-f"; "--best"; "--block-size=16777216"; "-c"; file ] in
let file_flags = [ Unix.O_WRONLY; Unix.O_CREAT; Unix.O_TRUNC; ] in
let outfd = Unix.openfile outimg file_flags 0o666 in
let res = run_command cmd ~stdout_fd:outfd in
if res <> 0 then
error (f_"xz command failed");
outimg
let get_mime_type filepath =
let file_cmd = "file --mime-type --brief " ^ (quote filepath) in
match external_command file_cmd with
| [] -> None
| line :: _ -> Some line
let get_disk_image_info filepath =
let infos = get_image_infos filepath in
{
format = object_get_string "format" infos;
size = object_get_number "virtual-size" infos
}
let cmp a b =
Index.string_of_arch a = Index.string_of_arch b
let has_entry id arch index =
List.exists (
fun (item_id, { Index.arch = item_arch }) ->
item_id = id && cmp item_arch arch
) index
let process_image acc_entries filename repo tmprepo index interactive
compression sigchecker =
message (f_"Preparing %s") filename;
let filepath = repo // filename in
let { format; size } = get_disk_image_info filepath in
let out_path =
if not compression then filepath
else compress_to filepath tmprepo in
let out_filename = Filename.basename out_path in
let checksum = Checksums.compute_checksum "sha512" out_path in
let compressed_size = (Unix.LargeFile.stat out_path).Unix.LargeFile.st_size in
let ask ~default ?values message =
printf "%s [%s] " message default;
(match values with
| None -> ()
| Some x ->
printf (f_"Choose one from the list below:\n %s\n")
(String.concat "\n " x));
let value = read_line () in
if value = "" then
default
else
value
in
let re_valid_id = PCRE.compile ~anchored:true "[-a-zA-Z0-9_.]+" in
let rec ask_id default =
let id = ask (s_"Identifier: ") ~default in
if not (PCRE.matches re_valid_id id) then (
warning (f_"Allowed characters are letters, digits, - _ and .");
ask_id default
) else
id in
let ask_arch guess =
let arches = [ "x86_64"; "aarch64"; "armv7l"; "i686"; "ppc64"; "ppc64le"; "s390x" ] in
Index.Arch (ask (s_"Architecture: ") ~default:guess ~values:arches)
in
let ask_osinfo default =
let osinfo = ask (s_ "osinfo short ID: ") ~default in
let osinfo_ids = osinfo_get_short_ids () in
if not (StringSet.mem osinfo osinfo_ids) then
warning (f_"%s is not a recognized osinfo OS id; using it anyway") osinfo;
osinfo in
let extract_entry_data ?entry () =
message (f_"Extracting data from the image...");
let g = Tools_utils.open_guestfs () in
g#add_drive_ro filepath;
g#launch ();
let roots = g#inspect_os () in
let nroots = Array.length roots in
if nroots <> 1 then
error (f_"virt-builder template images must have one and only one root file system, found %d")
nroots;
let root = Array.get roots 0 in
let inspected_arch = g#inspect_get_arch root in
let product = g#inspect_get_product_name root in
let shortid = g#inspect_get_osinfo root in
let lvs = g#lvs () in
let filesystems = g#inspect_get_filesystems root in
g#close ();
let id =
match entry with
| Some (id, _) -> id
| None -> (
if interactive then ask_id shortid
else error (f_"missing image identifier")
) in
let arch =
match entry with
| Some (_, { Index.arch }) -> (
match arch with
| Index.Arch arch -> Index.Arch arch
| Index.GuessedArch arch ->
if interactive then ask_arch arch
else Index.Arch arch )
| None ->
if interactive then ask_arch inspected_arch
else Index.Arch inspected_arch in
if has_entry id arch acc_entries then (
let arch =
match arch with
| Index.Arch arch
| Index.GuessedArch arch -> arch in
error (f_"Already existing image with id %s and architecture %s") id arch
);
let printable_name =
match entry with
| Some (_, { Index.printable_name }) ->
if printable_name = None then
if interactive then Some (ask (s_"Display name: ") ~default:product)
else Some product
else
printable_name
| None -> Some product in
let osinfo =
match entry with
| Some (_, { Index.osinfo }) ->
if osinfo = None then
Some (if interactive then ask_osinfo shortid else shortid)
else
osinfo
| None ->
Some (if interactive then ask_osinfo shortid else shortid) in
let expand =
match entry with
| Some (_, { Index.expand }) ->
if expand = None then
if interactive then
Some (ask (s_"Expandable partition: ") ~default:root
~values:(Array.to_list filesystems))
else Some root
else
expand
| None ->
if interactive then
Some (ask (s_"Expandable partition: ") ~default:root
~values:(Array.to_list filesystems))
else Some root in
let lvexpand =
if lvs = [||] then
None
else
match entry with
| Some (_, { Index.lvexpand }) ->
if lvexpand = None then
if interactive then
Some (ask (s_"Expandable volume: ") ~values:(Array.to_list lvs)
~default:(Array.get lvs 0))
else Some (Array.get lvs 0)
else
lvexpand
| None ->
if interactive then
Some (ask (s_"Expandable volume: ") ~values:(Array.to_list lvs)
~default:(Array.get lvs 0))
else Some (Array.get lvs 0) in
let revision =
match entry with
| Some (_, { Index.revision }) ->
Utils.increment_revision revision
| None -> Rev_int 1 in
let notes =
match entry with
| Some (_, { Index.notes }) -> notes
| None -> [] in
let hidden =
match entry with
| Some (_, { Index.hidden }) -> hidden
| None -> false in
let aliases =
match entry with
| Some (_, { Index.aliases }) -> aliases
| None -> None in
(id, { Index.printable_name;
osinfo;
file_uri = Filename.basename out_path;
arch;
signature_uri = None;
checksums = Some [checksum];
revision;
format = Some format;
size;
compressed_size = Some compressed_size;
expand;
lvexpand;
notes;
hidden;
aliases;
sigchecker;
proxy = Curl.SystemProxy })
in
(* Do we have an entry for that file already? *)
let file_entry =
try
List.hd (
List.filter (
fun (_, { Index.file_uri }) ->
let basename = Filename.basename file_uri in
basename = out_filename || basename = filename
) index
)
with
| Failure _ -> extract_entry_data () in
let _, { Index.checksums } = file_entry in
let old_checksum = checksums_get_sha512 checksums in
match old_checksum with
| Some old_sum ->
if old_sum = checksum then
let id, entry = file_entry in
(id, { entry with Index.file_uri = out_filename })
else
extract_entry_data ~entry:file_entry ()
| None ->
extract_entry_data ~entry:file_entry ()
let unsafe_remove_directory_prefix parent path =
if path = parent then
""
else if String.is_prefix path (parent // "") then (
let len = String.length parent in
String.sub path (len+1) (String.length path - len-1)
) else
invalid_arg (sprintf "%S is not a path prefix of %S" parent path)
let main () =
let cmdline = parse_cmdline () in
(* If debugging, echo the command line arguments. *)
debug "command line: %s" (String.concat " " (Array.to_list Sys.argv));
(* Check that the paths are existing *)
if not (Sys.file_exists cmdline.repo) then
error (f_"repository folder %s doesnt exist") cmdline.repo;
(* Create a temporary folder to work in *)
let tmpdir = Mkdtemp.temp_dir ~base_dir:cmdline.repo
"virt-builder-repository." in
rmdir_on_exit tmpdir;
let tmprepo = tmpdir // "repo" in
mkdir_p tmprepo 0o700;
let sigchecker = Sigchecker.create ~gpg:cmdline.gpg
~check_signature:false
~gpgkey:No_Key
~tmpdir in
let index =
try
let index_filename =
List.find (
fun filename -> Sys.file_exists (cmdline.repo // filename)
) [ "index.asc"; "index" ] in
let downloader = Downloader.create ~curl:"do-not-use-curl"
~cache:None ~tmpdir in
let source = { Sources.name = index_filename;
uri = cmdline.repo // index_filename;
gpgkey = No_Key;
proxy = Curl.SystemProxy;
format = Sources.FormatNative } in
Index_parser.get_index ~downloader ~sigchecker ~template:true source
with Not_found -> [] in
(* Check for index/interactive consistency *)
if not cmdline.interactive && index = [] then
error (f_"the repository must contain an index file when running in automated mode");
debug "Searching for images ...";
let images =
let is_supported_format file =
let extension = last_part_of file '.' in
match extension with
| Some ext -> List.mem ext [ "qcow2"; "raw"; "img" ]
| None ->
match get_mime_type file with
| None -> false
| Some mime -> mime = "application/octet-stream" in
let is_new file =
try
let _, { Index.checksums } =
List.find (
fun (_, { Index.file_uri }) ->
Filename.basename file_uri = file
) index in
let checksum = checksums_get_sha512 checksums in
let path = cmdline.repo // file in
let file_checksum = Checksums.compute_checksum "sha512" path in
match checksum with
| None -> true
| Some sum -> sum <> file_checksum
with Not_found -> true in
let files = Array.to_list (Sys.readdir cmdline.repo) in
let files = List.filter (
fun file -> is_regular_file (cmdline.repo // file)
) files in
List.filter (
fun file -> is_supported_format (cmdline.repo // file) && is_new file
) files in
if images = [] then (
info (f_ "No new image found");
exit 0
);
info (f_ "Found new images: %s") (String.concat " " images);
with_open_out (tmprepo // "index") (
fun index_channel ->
(* Generate entries for uncompressed images *)
let images_entries = List.fold_right (
fun filename acc ->
let image_entry = process_image acc
filename
cmdline.repo
tmprepo
index
cmdline.interactive
cmdline.compression
sigchecker in
image_entry :: acc
) images [] in
(* Filter out entries for newly found images and entries
without a corresponding image file or with empty arch *)
let index = List.filter (
fun (id, { Index.arch; file_uri }) ->
not (has_entry id arch images_entries) && Sys.file_exists file_uri
) index in
(* Convert all URIs back to relative ones *)
let index = List.map (
fun (id, entry) ->
let { Index.file_uri } = entry in
let rel_path =
try (* XXX wrong *)
unsafe_remove_directory_prefix cmdline.repo file_uri
with
| Invalid_argument _ ->
file_uri in
let rel_entry = { entry with Index.file_uri = rel_path } in
(id, rel_entry)
) index in
(* Write all the entries *)
List.iter (
fun entry ->
Index_parser.write_entry index_channel entry;
) (index @ images_entries);
);
(* GPG sign the generated index *)
(match cmdline.gpgkey with
| None ->
debug "Skip index signing"
| Some gpgkey ->
message (f_"Signing index with the GPG key %s") gpgkey;
let cmd = sprintf "%s --armor --output %s --export %s"
(quote (cmdline.gpg // "index.gpg"))
(quote tmprepo) (quote gpgkey) in
if shell_command cmd <> 0 then
error (f_"failed to export the GPG key %s") gpgkey;
let cmd = sprintf "%s --armor --default-key %s --clearsign %s"
(quote cmdline.gpg) (quote gpgkey)
(quote (tmprepo // "index" )) in
if shell_command cmd <> 0 then
error (f_"failed to sign index");
);
message (f_"Creating index backup copy");
List.iter (
fun filename ->
let filepath = cmdline.repo // filename in
if Sys.file_exists filepath then
do_mv filepath (filepath ^ ".bak")
) ["index"; "index.asc"];
message (f_"Moving files to final destination");
Array.iter (
fun filename ->
do_mv (tmprepo // filename) cmdline.repo
) (Sys.readdir tmprepo);
debug "Cleanup";
(* Remove the processed image files *)
if cmdline.compression then
List.iter (
fun filename -> Sys.remove (cmdline.repo // filename)
) images
let () = run_main_and_handle_errors main

View File

@@ -1,61 +0,0 @@
/* virt-builder
* 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.
*/
#include <config.h>
#include <locale.h>
#include <caml/alloc.h>
#include <caml/fail.h>
#include <caml/memory.h>
#include <caml/mlvalues.h>
static const int lc_string_table[7] = {
LC_ALL,
LC_CTYPE,
LC_NUMERIC,
LC_TIME,
LC_COLLATE,
LC_MONETARY,
LC_MESSAGES
};
#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)
{
CAMLparam2 (val_category, val_name);
CAMLlocal2 (rv, rv2);
char *ret, *locstring;
int category;
category = lc_string_table[Int_val (val_category)];
locstring = val_name == Val_none ? NULL : String_val (Field (val_name, 0));
ret = setlocale (category, locstring);
if (ret) {
rv2 = caml_copy_string (ret);
rv = caml_alloc (1, 0);
Store_field (rv, 0, rv2);
} else
rv = Val_none;
CAMLreturn (rv);
}

View File

@@ -1,29 +0,0 @@
(* virt-builder
* 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.
*)
type localecategory =
| LC_ALL
| LC_CTYPE
| LC_NUMERIC
| LC_TIME
| LC_COLLATE
| LC_MONETARY
| LC_MESSAGES
;;
external setlocale : localecategory -> string option -> string option = "virt_builder_setlocale"

View File

@@ -1,30 +0,0 @@
(* virt-builder
* 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.
*)
type localecategory =
| LC_ALL
| LC_CTYPE
| LC_NUMERIC
| LC_TIME
| LC_COLLATE
| LC_MONETARY
| LC_MESSAGES
;;
val setlocale : localecategory -> string option -> string option
(** [setlocale category newlocale] Tiny wrapper to the C [setlocale]. *)

View File

@@ -1,221 +0,0 @@
(* virt-builder
* Copyright (C) 2013 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
open Std_utils
open Tools_utils
open Unix_utils
open Common_gettext.Gettext
open Utils
open Printf
open Unix
type t = {
gpg : string;
fingerprint : string;
subkeys_fingerprints : string list;
check_signature : bool;
gpghome : string;
tmpdir : string;
}
(* Import the specified key file. *)
let import_keyfile ~gpg ~gpghome ~tmpdir ?(trust = true) keyfile =
let status_file = Filename.temp_file ~temp_dir:tmpdir "vbstat" ".txt" in
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
let r = shell_command cmd in
if r <> 0 then
error (f_"could not import public key\nUse the -v option and look for earlier error messages.");
let status = read_whole_file status_file in
let status = String.nsplit "\n" status in
let key_id = ref "" in
let fingerprint = ref "" in
List.iter (
fun line ->
let line = String.nsplit " " line in
match line with
| "[GNUPG:]" :: "IMPORT_OK" :: _ :: fp :: _ -> fingerprint := fp
| "[GNUPG:]" :: "IMPORTED" :: key :: _ -> key_id := key
| _ -> ()
) status;
if trust then (
let cmd = sprintf "%s --homedir %s --trusted-key %s --list-keys%s"
gpg gpghome (quote !key_id)
(if verbose () then "" else " >/dev/null 2>&1") in
let r = shell_command cmd in
if r <> 0 then
error (f_"GPG failure: could not trust the imported key\nUse the -v option and look for earlier error messages.");
);
let subkeys =
(* --with-fingerprint is specified twice so gpg outputs the full
* fingerprint of the subkeys. *)
let cmd = sprintf "%s --homedir %s --with-colons --with-fingerprint --with-fingerprint --list-keys %s"
gpg gpghome !fingerprint in
let lines = external_command cmd in
let current = ref None in
let subkeys = ref [] in
List.iter (
fun line ->
let line = String.nsplit ":" line in
match line with
| "sub" :: ("u"|"-") :: _ :: _ :: id :: _ ->
current := Some id
| "fpr" :: _ :: _ :: _ :: _ :: _ :: _ :: _ :: _ :: id :: _ ->
(match !current with
| None -> ()
| Some k ->
if String.is_suffix id k then List.push_front id subkeys;
current := None
)
| _ -> ()
) lines;
!subkeys in
!fingerprint, subkeys
let rec create ~gpg ~gpgkey ~check_signature ~tmpdir =
(* Create a temporary directory for gnupg. *)
let gpgtmpdir = Mkdtemp.temp_dir ~base_dir:tmpdir "vb.gpghome." in
(* Make sure we have no check_signature=true with no actual key. *)
let check_signature, gpgkey =
match check_signature, gpgkey with
| true, No_Key -> false, No_Key
| x, y -> x, y in
let fingerprint, subkeys =
if check_signature then (
(* Run gpg so it can setup its own home directory, failing if it
* cannot.
*)
let cmd = sprintf "%s --homedir %s --list-keys%s"
gpg gpgtmpdir (if verbose () then "" else " >/dev/null 2>&1") in
let r = shell_command cmd in
if r <> 0 then
error (f_"GPG failure: could not run GPG the first time\nUse the -v option and look for earlier error messages.");
match gpgkey with
| No_Key ->
assert false
| KeyFile kf ->
import_keyfile gpg gpgtmpdir tmpdir kf
| Fingerprint fp ->
let filename = Filename.temp_file ~temp_dir:tmpdir "vbpubkey" ".asc" in
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
let r = shell_command cmd in
if r <> 0 then
error (f_"could not export public key\nUse the -v option and look for earlier error messages.");
import_keyfile gpg gpgtmpdir tmpdir filename
) else
"", [] in
{
gpg = gpg;
fingerprint = fingerprint;
subkeys_fingerprints = subkeys;
check_signature = check_signature;
gpghome = gpgtmpdir;
tmpdir = tmpdir;
}
(* Compare two strings of hex digits ignoring whitespace and case. *)
and equal_fingerprints fp1 fp2 =
let len1 = String.length fp1 and len2 = String.length fp2 in
let rec loop i j =
if i = len1 && j = len2 then true (* match! *)
else if i = len1 || j = len2 then false (* no match - different lengths *)
else (
let x1 = getxdigit fp1.[i] and x2 = getxdigit fp2.[j] in
match x1, x2 with
| Some x1, Some x2 when x1 = x2 -> loop (i+1) (j+1)
| Some x1, Some x2 -> false (* no match - different content *)
| Some _, None -> loop i (j+1)
| None, Some _ -> loop (i+1) j
| None, None -> loop (i+1) (j+1)
)
in
loop 0 0
and getxdigit = function
| '0'..'9' as c -> Some (Char.code c - Char.code '0')
| 'a'..'f' as c -> Some (Char.code c - Char.code 'a')
| 'A'..'F' as c -> Some (Char.code c - Char.code 'A')
| _ -> None
let verifying_signatures t =
t.check_signature
let rec verify t filename =
if t.check_signature then (
let args = quote filename in
do_verify t args
)
and verify_detached t filename sigfile =
if t.check_signature then (
match sigfile with
| None ->
error (f_"there is no detached signature file\nThis probably means the index file is missing a sig=... line.\nYou can use --no-check-signature to ignore this error, but that means you are susceptible to man-in-the-middle attacks.")
| Some sigfile ->
let args = sprintf "%s %s" (quote sigfile) (quote filename) in
do_verify t args
)
and verify_and_remove_signature t filename =
if t.check_signature then (
(* Copy the input file as temporary file with the .asc extension,
* so gpg recognises that format. *)
let asc_file = Filename.temp_file ~temp_dir:t.tmpdir "vbfile" ".asc" in
let cmd = [ "cp"; filename; asc_file ] in
if run_command cmd <> 0 then exit 1;
let out_file = Filename.temp_file ~temp_dir:t.tmpdir "vbfile" "" in
let args = sprintf "--yes --output %s %s" (quote out_file) (quote filename) in
do_verify ~verify_only:false t args;
Some out_file
) else
None
and do_verify ?(verify_only = true) t args =
let status_file = Filename.temp_file ~temp_dir:t.tmpdir "vbstat" ".txt" in
let cmd =
sprintf "%s --homedir %s %s%s --status-file %s %s"
t.gpg t.gpghome
(if verify_only then "--verify" else "")
(if verbose () then "" else " --batch -q --logger-file /dev/null")
(quote status_file) args in
let r = shell_command cmd in
if r <> 0 then
error (f_"GPG failure: could not verify digital signature of file\nTry:\n - Use the -v option and look for earlier error messages.\n - Delete the cache: virt-builder --delete-cache\n - Check no one has tampered with the website or your network!");
(* Check the fingerprint is who it should be. *)
let status = read_whole_file status_file in
let status = String.nsplit "\n" status in
let fingerprint = ref "" in
List.iter (
fun line ->
let line = String.nsplit " " line in
match line with
| "[GNUPG:]" :: "VALIDSIG" :: fp :: _ -> fingerprint := fp
| _ -> ()
) status;
if not (equal_fingerprints !fingerprint t.fingerprint) &&
not (List.exists (equal_fingerprints !fingerprint) t.subkeys_fingerprints) then
error (f_"fingerprint of signature does not match the expected fingerprint!\n found fingerprint: %s\n expected fingerprint: %s")
!fingerprint t.fingerprint

View File

@@ -1,36 +0,0 @@
(* virt-builder
* Copyright (C) 2013 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
type t
val create : gpg:string -> gpgkey:Utils.gpgkey_type -> check_signature:bool -> tmpdir:string -> t
val verifying_signatures : t -> bool
(** Return whether signatures are being verified by this
Sigchecker.t. *)
val verify : t -> string -> unit
(** Verify the file is signed (if check_signature is true). *)
val verify_detached : t -> string -> string option -> unit
(** Verify the file is signed against the detached signature
(if check_signature is true). *)
val verify_and_remove_signature : t -> string -> string option
(** If check_signature is true, verify the file is signed and extract
the content of the file (i.e. without the signature). *)

View File

@@ -1,153 +0,0 @@
(* virt-builder
* Copyright (C) 2015 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
open Std_utils
open Tools_utils
open Common_gettext.Gettext
open JSON_parser
open Utils
open Printf
let ensure_trailing_slash str =
if String.length str > 0 && str.[String.length str - 1] <> '/' then str ^ "/"
else str
let get_index ~downloader ~sigchecker { Sources.uri; proxy } =
let uri = ensure_trailing_slash uri in
let download_and_parse uri =
let tmpfile, _ = Downloader.download downloader ~proxy uri in
let file =
if Sigchecker.verifying_signatures sigchecker then (
let tmpunsigned =
Sigchecker.verify_and_remove_signature sigchecker tmpfile in
match tmpunsigned with
| None -> assert false (* only when not verifying signatures *)
| Some f -> f
) else
tmpfile in
json_parser_tree_parse_file file in
let downloads =
let uri_index =
if Sigchecker.verifying_signatures sigchecker then
uri ^ "streams/v1/index.sjson"
else
uri ^ "streams/v1/index.json" in
let tree = download_and_parse uri_index in
let format = object_get_string "format" tree in
if format <> "index:1.0" then
error (f_"%s is not a Simple Streams (index) v1.0 JSON file (format: %s)")
uri format;
let index = object_get_object "index" tree in
List.filter_map (
fun (_, desc) ->
let format = object_get_string "format" desc in
let datatype = object_get_string "datatype" desc in
match format, datatype with
| "products:1.0", "image-downloads" ->
Some (object_get_string "path" desc)
| _ -> None
) index in
let scan_product_list path =
let tree = download_and_parse (uri ^ path) in
let format = object_get_string "format" tree in
if format <> "products:1.0" then
error (f_"%s is not a Simple Streams (products) v1.0 JSON file (format: %s)")
uri format;
let products = object_get_object "products" tree in
List.filter_map (
fun (prod, prod_desc) ->
let arch = Index.Arch (object_get_string "arch" prod_desc) in
let prods = object_get_object "versions" prod_desc in
let prods = List.filter_map (
fun (rel, rel_desc) ->
let pubname = objects_get_string "pubname" [rel_desc; prod_desc] in
let items = object_find_object "items" rel_desc in
let disk_items = object_find_objects (
function
| (("disk.img"|"disk1.img"), v) -> Some v
| _ -> None
) items in
(match disk_items with
| [] -> None
| disk_item :: _ ->
let printable_name = Some pubname in
let file_uri = uri ^ (object_get_string "path" disk_item) in
let checksums =
let checksums = object_find_objects (
function
(* Since this catches all the keys, and not just
* the ones related to checksums, explicitly filter
* the supported checksums.
*)
| ("sha256"|"sha512" as t, JSON.String c) ->
Some (Checksums.of_string t c)
| _ -> None
) disk_item in
match checksums with
| [] -> None
| x -> Some x in
let revision = Rev_string rel in
let size = object_get_number "size" disk_item in
let aliases = Some [pubname;] in
let entry = { Index.printable_name = printable_name;
osinfo = None;
file_uri = file_uri;
arch = arch;
signature_uri = None;
checksums = checksums;
revision = revision;
format = None;
size = size;
compressed_size = None;
expand = None;
lvexpand = None;
notes = [];
hidden = false;
aliases = aliases;
sigchecker = sigchecker;
proxy = proxy; } in
Some (rel, (prod, entry))
)
) prods in
(* Select the disk image with the bigger version (i.e. usually
* the most recent one. *)
let reverse_revision_compare (rev1, _) (rev2, _) = compare rev2 rev1 in
let prods = List.sort reverse_revision_compare prods in
match prods with
| [] -> None
| (_, entry) :: _ -> Some entry
) products in
let entries = List.flatten (List.map scan_product_list downloads) in
if verbose () then (
printf "simplestreams tree (%s) after parsing:\n" uri;
List.iter (Index.print_entry Pervasives.stdout) entries
);
entries

View File

@@ -1,19 +0,0 @@
(* virt-builder
* Copyright (C) 2015 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
val get_index : downloader:Downloader.t -> sigchecker:Sigchecker.t -> Sources.source -> Index.index

View File

@@ -1,142 +0,0 @@
(* virt-builder
* 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.
*)
open Std_utils
open Tools_utils
open Common_gettext.Gettext
open Printf
open Unix
type source = {
name : string;
uri : string;
gpgkey : Utils.gpgkey_type;
proxy : Curl.proxy;
format : source_format;
}
and source_format =
| FormatNative
| FormatSimpleStreams
let parse_conf file =
debug "trying to read %s" file;
let sections = Ini_reader.read_ini ~error_suffix:"[ignored]" file in
let sources = List.fold_right (
fun (n, fields) acc ->
let give_source n fields =
let fields = List.map (fun (k, sk, v) -> (k, sk), v) fields in
let uri =
try List.assoc ("uri", None) fields
with Not_found as ex ->
eprintf (f_"%s: no uri entry for %s in %s, skipping it\n") prog n file;
raise ex in
let gpgkey =
let k =
try Some (URI.parse_uri (List.assoc ("gpgkey", None) fields)) with
| Not_found -> None
| URI.Parse_failed as ex ->
debug "'%s' has invalid gpgkey URI" n;
raise ex in
match k with
| None -> Utils.No_Key
| Some uri ->
(match uri.URI.protocol with
| "file" -> Utils.KeyFile uri.URI.path
| _ ->
debug "'%s' has non-local gpgkey URI" n;
Utils.No_Key
) in
let proxy =
try
(match (List.assoc ("proxy", None) fields) with
| "no" | "off" -> Curl.UnsetProxy
| "system" -> Curl.SystemProxy
| _ as proxy -> Curl.ForcedProxy proxy
)
with
Not_found -> Curl.SystemProxy in
let format =
try
(match (List.assoc ("format", None) fields) with
| "native" | "" -> FormatNative
| "simplestreams" -> FormatSimpleStreams
| fmt ->
debug "unknown repository type '%s' in %s, skipping it" fmt file;
invalid_arg fmt
)
with
Not_found -> FormatNative in
{
name = n; uri = uri; gpgkey = gpgkey; proxy = proxy;
format = format;
}
in
try (give_source n fields) :: acc
with Not_found | Invalid_argument _ -> acc
) sections [] in
debug "read %d sources" (List.length sources);
sources
let merge_sources current_sources new_sources =
List.fold_right (
fun source acc ->
if List.exists (fun { name = n } -> n = source.name) acc then
acc
else
source :: acc
) new_sources current_sources
let filter_filenames filename =
Filename.check_suffix filename ".conf"
let read_sources () =
let dirs = Paths.xdg_config_dirs () in
let dirs =
match Paths.xdg_config_home () with
| None -> dirs
| Some dir -> dir :: dirs in
let dirs = List.map (fun x -> x // "repos.d") dirs in
let fnseen = ref StringSet.empty in
List.fold_left (
fun acc dir ->
let files =
try List.filter filter_filenames (Array.to_list (Sys.readdir dir))
with Sys_error _ -> [] in
let files = List.filter (fun x -> StringSet.mem x !fnseen <> true) files in
List.fold_left (
fun acc file ->
try (
let s = merge_sources acc (parse_conf (dir // file)) in
(* Add the current file name to the set only if its parsing
* was successful.
*)
fnseen := StringSet.add file !fnseen;
s
) with
| Unix_error (code, fname, _) ->
debug "file error: %s: %s\n" fname (error_message code);
acc
| Invalid_argument msg ->
debug "internal error: invalid argument: %s" msg;
acc
) acc files
) [] dirs

View File

@@ -1,30 +0,0 @@
(* virt-builder
* 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.
*)
type source = {
name : string;
uri : string;
gpgkey : Utils.gpgkey_type;
proxy : Curl.proxy;
format : source_format;
}
and source_format =
| FormatNative
| FormatSimpleStreams
val read_sources : unit -> source list

View File

@@ -1,46 +0,0 @@
# libguestfs virt-builder tool
# Copyright (C) 2013-2019 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.
include $(top_srcdir)/subdir-rules.mk
index_fragments = $(wildcard *.index-fragment)
EXTRA_DIST = \
$(index_fragments) \
*.ks \
*.virt-install-cmd \
debian.preseed \
make-template.ml \
ubuntu.preseed \
validate.sh
# Create the index file under the top level website/ directory.
noinst_DATA = $(top_builddir)/website/download/builder/index
$(top_builddir)/website/download/builder/index: $(index_fragments)
rm -f $@ $@-t
LANG=C sh -c 'cat *.index-fragment' > $@-t
mv $@-t $@
@echo "NOTE: $@.asc must be updated by running:"
@echo " gpg --clearsign --armor $@"
# Validates the index file.
TESTS_ENVIRONMENT = $(top_builddir)/run --test
TESTS = validate.sh
check-valgrind:
$(MAKE) VG="@VG@" check

View File

@@ -1,23 +0,0 @@
[centos-6]
name=CentOS 6.6
osinfo=centos6.6
arch=x86_64
file=centos-6.xz
revision=6
checksum=fc403ea3555a5608a25ad30ce2514b67288311a7197ddf9fb664475820f26db2bd95a86be9cd6e3f772187b384a02e0965430456dd518d343a80457057bc5441
format=raw
size=6442450944
compressed_size=199265736
expand=/dev/sda3
notes=CentOS 6.6
This CentOS 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/centos.sh
Note that virt-builder centos-6 will always install the latest
6.x release.

View File

@@ -1,19 +0,0 @@
[centos-7.0]
name=CentOS 7.0
osinfo=centos7.0
arch=x86_64
file=centos-7.0.xz
checksum=cf9ae295f633fbd04e575eeca16f372e933c70c3107c44eb06864760d04354aa94b4f356bfc9a598c138e687304a52e96777e4467e7db1ec0cb5b2d2ec61affc
format=raw
size=6442450944
compressed_size=213203844
expand=/dev/sda3
notes=CentOS 7.0
This CentOS 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/centos.sh

View File

@@ -1,19 +0,0 @@
[centos-7.1]
name=CentOS 7.1
osinfo=centos7.1
arch=x86_64
file=centos-7.1.xz
checksum=4bd2536710daa27a70ff69a96d8a694bde1ecf48d811e75d5e6881cfdcd214c0af6949d5a8252ace06e4e8b33337f65ccb16305c85ff88156d49ac559e840b5c
format=raw
size=6442450944
compressed_size=238579176
expand=/dev/sda3
notes=CentOS 7.1
This CentOS 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/centos.sh

View File

@@ -1,19 +0,0 @@
[centos-7.2]
name=CentOS 7.2 (aarch64)
osinfo=centos7.2
arch=aarch64
file=centos-7.2-aarch64.xz
checksum=e61c5381026c419110ec42626c1cbb0e081240ae4d8c70f5bac2c80d771d5159b72dd3723068cf3cc9339e095b05b62d29ba9c22ef199f53a4e89c07e5615ca3
format=raw
size=6442450944
compressed_size=248167668
expand=/dev/sda4
notes=CentOS 7.2 (aarch64)
This CentOS 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/centos-aarch64.sh

View File

@@ -1,19 +0,0 @@
[centos-7.2]
name=CentOS 7.2
osinfo=centos7.2
arch=x86_64
file=centos-7.2.xz
checksum=b32e6003d1f15e3a97e3644e35bb3fdc345a9b2e7448655d951ec331af6cd2b5548d6acfc9d92f09ac3a8a6439069c27fa539997118cb8a3f77d3bfa45c659d0
format=raw
size=6442450944
compressed_size=252158848
expand=/dev/sda3
notes=CentOS 7.2
This CentOS 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/centos.sh

View File

@@ -1,21 +0,0 @@
[centos-7.3]
name=CentOS 7.3
osinfo=centos7.3
arch=x86_64
file=centos-7.3.xz
revision=2
checksum[sha512]=07c8941506b1104a2571912060dc275455924415222397316fe28efd5501979c75a23c59b946acad481160b5260f61585c64777a4a9fe6f8365f9fa29df68e6c
format=raw
size=6442450944
compressed_size=294531760
expand=/dev/sda2
lvexpand=/dev/cl/root
notes=CentOS 7.3
This CentOS image contains only unmodified @Core group packages.
This template was generated by a script in the libguestfs source tree:
builder/templates/make-template.ml
Associated files used to prepare this template can be found in the
same directory.

View File

@@ -1,28 +0,0 @@
# Kickstart file for centos-7.3
# Generated by libguestfs.git/builder/templates/make-template.ml
install
text
reboot
lang en_US.UTF-8
keyboard us
network --bootproto dhcp
rootpw builder
firewall --enabled --ssh
timezone --utc America/New_York
selinux --enforcing
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH"
zerombr
clearpart --all --initlabel
autopart --type=lvm
# Halt the system once configuration has finished.
poweroff
%packages
@core
%end
# EOF

View File

@@ -1,19 +0,0 @@
[centos-7.4]
name=CentOS 7.4
osinfo=centos7.4
arch=x86_64
file=centos-7.4.xz
checksum[sha512]=593a0c2534b097ddb7bcf55f64d0095c6042f9d611ee297d56e8cf37d31e9c72df77bcbdd1580d704cef25b063df43935c8bf05c79fca362a89e3a633616ea6d
format=raw
size=6442450944
compressed_size=309453024
expand=/dev/sda3
notes=CentOS 7.4
This CentOS image contains only unmodified @Core group packages.
This template was generated by a script in the libguestfs source tree:
builder/templates/make-template.ml
Associated files used to prepare this template can be found in the
same directory.

View File

@@ -1,28 +0,0 @@
# Kickstart file for centos-7.4
# Generated by libguestfs.git/builder/templates/make-template.ml
install
text
reboot
lang en_US.UTF-8
keyboard us
network --bootproto dhcp
rootpw builder
firewall --enabled --ssh
timezone --utc America/New_York
selinux --enforcing
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH"
zerombr
clearpart --all --initlabel
autopart --type=plain
# Halt the system once configuration has finished.
poweroff
%packages
@core
%end
# EOF

View File

@@ -1,19 +0,0 @@
[centos-7.5]
name=CentOS 7.5
osinfo=centos7.5
arch=x86_64
file=centos-7.5.xz
checksum[sha512]=4d9c64aae69d1a18c6137554e25ba77d7bc7dd4dced88d359ed6d9cf91c252e67afc0c297b10bf58309cc09bbaaf2cec647cd1dd14b63edf0c31d55e209c3b2e
format=raw
size=6442450944
compressed_size=333305636
expand=/dev/sda4
notes=CentOS 7.5
This CentOS image contains only unmodified @Core group packages.
This template was generated by a script in the libguestfs source tree:
builder/templates/make-template.ml
Associated files used to prepare this template can be found in the
same directory.

View File

@@ -1,28 +0,0 @@
# Kickstart file for centos-7.5
# Generated by libguestfs.git/builder/templates/make-template.ml
install
text
reboot
lang en_US.UTF-8
keyboard us
network --bootproto dhcp
rootpw builder
firewall --enabled --ssh
timezone --utc America/New_York
selinux --enforcing
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH"
zerombr
clearpart --all --initlabel --disklabel=gpt
autopart --type=plain
# Halt the system once configuration has finished.
poweroff
%packages
@core
%end
# EOF

View File

@@ -1,19 +0,0 @@
# This is the virt-install command which was used to create
# the virt-builder template 'centos-7.5'
# NB: This file is generated for documentation purposes ONLY!
# This script was never run, and is not intended to be run.
'virt-install' \
'--transient' \
'--name=tmp-mfilsn2l' \
'--ram=2048' \
'--cpu=host' \
'--vcpus=4' \
'--os-variant=centos7.0' \
'--initrd-inject=centos-7.5.ks' \
'--extra-args=ks=file:/centos-7.5.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \
'--disk=/home/rjones/d/libguestfs/builder/templates/tmp-mfilsn2l.img,size=6,format=raw' \
'--location=http://mirror.centos.org/centos-7/7/os/x86_64/' \
'--serial=pty' \
'--nographics'

View File

@@ -1,19 +0,0 @@
[centos-7.6]
name=CentOS 7.6
osinfo=centos7.6
arch=x86_64
file=centos-7.6.xz
checksum[sha512]=aec0e3b2c012d97e01ff81afe924ce36f5fc8d8688f0ffc83f304f138619935af19d12525f1479f724c35a758feb92b659397805b0fab1fdc482ff5bf6e924d5
format=raw
size=6442450944
compressed_size=323800576
expand=/dev/sda4
notes=CentOS 7.6
This CentOS image contains only unmodified @Core group packages.
This template was generated by a script in the libguestfs source tree:
builder/templates/make-template.ml
Associated files used to prepare this template can be found in the
same directory.

View File

@@ -1,28 +0,0 @@
# Kickstart file for centos-7.6
# Generated by libguestfs.git/builder/templates/make-template.ml
install
text
reboot
lang en_US.UTF-8
keyboard us
network --bootproto dhcp
rootpw builder
firewall --enabled --ssh
timezone --utc America/New_York
selinux --enforcing
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH"
zerombr
clearpart --all --initlabel --disklabel=gpt
autopart --type=plain
# Halt the system once configuration has finished.
poweroff
%packages
@core
%end
# EOF

View File

@@ -1,20 +0,0 @@
# This is the virt-install command which was used to create
# the virt-builder template 'centos-7.6'
# NB: This file is generated for documentation purposes ONLY!
# This script was never run, and is not intended to be run.
'virt-install' \
'--transient' \
'--name=tmp-pi6i1jmm' \
'--ram=2048' \
'--arch=x86_64' \
'--cpu=host' \
'--vcpus=4' \
'--os-variant=centos7.0' \
'--initrd-inject=centos-7.6.ks' \
'--extra-args=ks=file:/centos-7.6.ks proxy=http://cache.home.annexia.org:3128 console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \
'--disk=/home/rjones/d/libguestfs/builder/templates/tmp-pi6i1jmm.img,size=6,format=raw' \
'--location=http://mirror.centos.org/centos-7/7/os/x86_64/' \
'--serial=pty' \
'--nographics'

View File

@@ -1,19 +0,0 @@
[cirros-0.3.1]
name=CirrOS 0.3.1
arch=x86_64
file=cirros-0.3.1.xz
checksum=096209f00eb62d5722accf3d22ca3a4ee5baaac6d7d4ce0be93b56bbd1c8ab2e3eb4f5db1deffcb570e2c3d41f4d721798a1c499675346cee9546554a4b10388
format=raw
size=41126400
compressed_size=11419004
expand=/dev/sda1
notes=CirrOS 0.3.1
CirrOS is a commonly used test image, ideal because it is very
small and boots into a minimally usable Linux system.
Note this is not a real Linux distribution, and several virt-builder
features such as installing packages will not (and cannot) work.
This CirrOS image comes from https://launchpad.net/cirros

View File

@@ -1,21 +0,0 @@
[cirros-0.3.5]
name=CirrOS 0.3.5
arch=x86_64
file=cirros-0.3.5.xz
checksum=77f74203aa26e843e83f522ba44d765c6ba9ab595c19c14d629064c71f875158beb7e93e7b6ac5e6895c6e3b6daa8b94d7286230b9fdf166ae65d0d6e9c9329a
format=raw
size=41126400
compressed_size=11479284
expand=/dev/sda1
notes=CirrOS 0.3.5
CirrOS is a commonly used test image, ideal because it is very
small and boots into a minimally usable Linux system.
Note this is not a real Linux distribution, and several virt-builder
features such as installing packages will not (and cannot) work.
This CirrOS image comes from https://download.cirros-cloud.net/0.3.5/
and was prepared by running qemu-img convert .. -O raw followed by
xz --best.

View File

@@ -1,32 +0,0 @@
[debian-6]
name=Debian 6 (Squeeze)
osinfo=debian6
arch=x86_64
file=debian-6.xz
revision=2
checksum=bff9c28da0375fde65fa238d7a2ea644cbfad0ea3246783a2f44a98f2374850987679c3f1032a632d3c6238de8d9e43291d07a82efc1e824945000e206b9f6cc
format=raw
size=4294967296
compressed_size=139615908
expand=/dev/sda1
notes=Debian 6 (Squeeze).
This is a default Debian install.
The preseed and virt-install scripts that produced this image
can be found in the libguestfs source tree:
builder/website/debian.preseed
builder/website/debian.sh
This image is so very minimal that it only includes an ssh
server and no virtual consoles. To enable virtual consoles
use this virt-builder option:
virt-builder debian-6 \
--edit '/etc/inittab: s,^#([1-9].*respawn.*/sbin/getty.*),$1,'
This image does not contain SSH host keys. To regenerate them use:
--firstboot-command "dpkg-reconfigure openssh-server"

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