[PATCH] parse_libvirt_xml: look for manual firmware in "/domain/os/loader"
by Andrey Drobyshev
According to [1], there're different ways to specify which firmware is
to be used by a libvirt-driven VM. Namely, there's an automatic
firmware selection, e.g.:
...
<os firmware='(bios|efi)'>
...
and a manual one, e.g.:
...
<os>
<loader readonly='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.fd</loader>
...
</os>
...
with the latter being a way to specify UEFI firmware. So let's add this
search path as well when parsing source VM's libvirt xml.
[1] https://libvirt.org/formatdomain.html#bios-bootloader
Signed-off-by: Andrey Drobyshev <andrey.drobyshev(a)virtuozzo.com>
Originally-by: Denis Plotnikov <dplotnikov(a)virtuozzo.com>
---
input/parse_libvirt_xml.ml | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/input/parse_libvirt_xml.ml b/input/parse_libvirt_xml.ml
index 1e98ce1a..afe3fbc2 100644
--- a/input/parse_libvirt_xml.ml
+++ b/input/parse_libvirt_xml.ml
@@ -446,12 +446,27 @@ let parse_libvirt_xml ?conn xml =
done;
List.rev !nics in
- (* Firmware. *)
+ (* Firmware.
+ * If "/domain/os" node doesn't contain "firmware" attribute (automatic
+ * firmware), we look for the presence of "OVMF_CODE" in "/domain/os/loader"
+ * node (manual firmware).
+ * See https://libvirt.org/formatdomain.html#bios-bootloader
+ *)
let firmware =
match xpath_string "/domain/os/@firmware" with
| Some "bios" -> BIOS
| Some "efi" -> UEFI
- | None | Some _ -> UnknownFirmware in
+ | None | Some _ -> (
+ let loader = xpath_string "/domain/os/loader" in
+ match loader with
+ | None -> UnknownFirmware
+ | _ -> (
+ let re = Str.regexp_string "OVMF_CODE" in
+ let loader = Option.default "" loader in
+ try ignore (Str.search_forward re loader 0); UEFI
+ with Not_found -> UnknownFirmware
+ )
+ ) in
(* Check for hostdev devices. (RHBZ#1472719) *)
let () =
--
2.31.1
2 years
LibGuest Issue
by Helen Le
1. Trying to run this command to use RHEL VM on Ubuntu VM: sudo virt-customize -a rhel-baseos-9.0-aarch64-kvm.qcow2 --root-password password:root
2. see above
3. attached below
************************************************************
* IMPORTANT NOTICE
*
* When reporting bugs, include the COMPLETE, UNEDITED
* output below in your bug report.
*
************************************************************
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: trace: set_backend "direct"
libguestfs: trace: set_backend = 0
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
LIBGUESTFS_TRACE=1
LIBGUESTFS_BACKEND=direct
LIBGUESTFS_DEBUG=1
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
XDG_RUNTIME_DIR=/run/user/1000
SELinux: sh: 1: getenforce: not found
libguestfs: trace: add_drive_scratch 104857600
libguestfs: trace: get_tmpdir
libguestfs: trace: get_tmpdir = "/tmp"
libguestfs: trace: disk_create "/tmp/libguestfs6ruxy0/scratch1.img" "raw" 104857600
libguestfs: trace: disk_create = 0
libguestfs: trace: add_drive "/tmp/libguestfs6ruxy0/scratch1.img" "format:raw" "cachemode:unsafe"
libguestfs: trace: add_drive = 0
libguestfs: trace: add_drive_scratch = 0
libguestfs: trace: get_append
libguestfs: trace: get_append = "NULL"
guestfs_get_append: (null)
libguestfs: trace: get_autosync
libguestfs: trace: get_autosync = 1
guestfs_get_autosync: 1
libguestfs: trace: get_backend
libguestfs: trace: get_backend = "direct"
guestfs_get_backend: direct
libguestfs: trace: get_backend_settings
libguestfs: trace: get_backend_settings = []
guestfs_get_backend_settings: []
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/var/tmp"
guestfs_get_cachedir: /var/tmp
libguestfs: trace: get_hv
libguestfs: trace: get_hv = "/usr/bin/qemu-system-x86_64"
guestfs_get_hv: /usr/bin/qemu-system-x86_64
libguestfs: trace: get_memsize
libguestfs: trace: get_memsize = 768
guestfs_get_memsize: 768
libguestfs: trace: get_network
libguestfs: trace: get_network = 0
guestfs_get_network: 0
libguestfs: trace: get_path
libguestfs: trace: get_path = "/usr/lib/x86_64-linux-gnu/guestfs"
guestfs_get_path: /usr/lib/x86_64-linux-gnu/guestfs
libguestfs: trace: get_pgroup
libguestfs: trace: get_pgroup = 0
guestfs_get_pgroup: 0
libguestfs: trace: get_program
libguestfs: trace: get_program = "libguestfs-test-tool"
guestfs_get_program: libguestfs-test-tool
libguestfs: trace: get_recovery_proc
libguestfs: trace: get_recovery_proc = 1
guestfs_get_recovery_proc: 1
libguestfs: trace: get_smp
libguestfs: trace: get_smp = 1
guestfs_get_smp: 1
libguestfs: trace: get_sockdir
libguestfs: trace: get_sockdir = "/run/user/1000"
guestfs_get_sockdir: /run/user/1000
libguestfs: trace: get_tmpdir
libguestfs: trace: get_tmpdir = "/tmp"
guestfs_get_tmpdir: /tmp
libguestfs: trace: get_trace
libguestfs: trace: get_trace = 1
guestfs_get_trace: 1
libguestfs: trace: get_verbose
libguestfs: trace: get_verbose = 1
guestfs_get_verbose: 1
host_cpu: x86_64
Launching appliance, timeout set to 600 seconds.
libguestfs: trace: launch
libguestfs: trace: max_disks
libguestfs: trace: max_disks = 255
libguestfs: trace: version
libguestfs: trace: version = <struct guestfs_version = major: 1, minor: 40, release: 2, extra: , >
libguestfs: trace: get_backend
libguestfs: trace: get_backend = "direct"
libguestfs: launch: program=libguestfs-test-tool
libguestfs: launch: version=1.40.2
libguestfs: launch: backend registered: unix
libguestfs: launch: backend registered: uml
libguestfs: launch: backend registered: libvirt
libguestfs: launch: backend registered: direct
libguestfs: launch: backend=direct
libguestfs: launch: tmpdir=/tmp/libguestfs6ruxy0
libguestfs: launch: umask=0002
libguestfs: launch: euid=1000
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/var/tmp"
libguestfs: begin building supermin appliance
libguestfs: run supermin
libguestfs: command: run: /usr/bin/supermin
libguestfs: command: run: \ --build
libguestfs: command: run: \ --verbose
libguestfs: command: run: \ --if-newer
libguestfs: command: run: \ --lock /var/tmp/.guestfs-1000/lock
libguestfs: command: run: \ --copy-kernel
libguestfs: command: run: \ -f ext2
libguestfs: command: run: \ --host-cpu x86_64
libguestfs: command: run: \ /usr/lib/x86_64-linux-gnu/guestfs/supermin.d
libguestfs: command: run: \ -o /var/tmp/.guestfs-1000/appliance.d
supermin: version: 5.1.20
supermin: package handler: debian/dpkg
supermin: acquiring lock on /var/tmp/.guestfs-1000/lock
supermin: build: /usr/lib/x86_64-linux-gnu/guestfs/supermin.d
supermin: reading the supermin appliance
supermin: build: visiting /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/base.tar.gz type gzip base image (tar)
supermin: build: visiting /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/daemon.tar.gz type gzip base image (tar)
supermin: build: visiting /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/excludefiles type uncompressed excludefiles
supermin: build: visiting /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/hostfiles type uncompressed hostfiles
supermin: build: visiting /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/init.tar.gz type gzip base image (tar)
supermin: build: visiting /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/packages type uncompressed packages
supermin: build: visiting /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/packages-hfsplus type uncompressed packages
supermin: build: visiting /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/packages-reiserfs type uncompressed packages
supermin: build: visiting /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/packages-xfs type uncompressed packages
supermin: build: visiting /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/udev-rules.tar.gz type gzip base image (tar)
supermin: mapping package names to installed packages
supermin: resolving full list of package dependencies
supermin: build: 236 packages, including dependencies
supermin: build: 12301 files
supermin: build: 8874 files, after matching excludefiles
supermin: build: 8877 files, after adding hostfiles
supermin: build: 8874 files, after removing unreadable files
supermin: build: 8882 files, after munging
supermin: kernel: looking for kernel using environment variables ...
supermin: kernel: looking for kernels in /lib/modules/*/vmlinuz ...
supermin: kernel: looking for kernels in /boot ...
supermin: kernel: kernel version of /boot/vmlinuz-5.15.0-56-generic = 5.15.0-56-generic (from filename)
supermin: kernel: picked modules path /lib/modules/5.15.0-56-generic
supermin: kernel: kernel version of /boot/vmlinuz-5.15.0-53-generic = 5.15.0-53-generic (from filename)
supermin: kernel: picked modules path /lib/modules/5.15.0-53-generic
supermin: kernel: picked vmlinuz /boot/vmlinuz-5.15.0-56-generic
supermin: kernel: kernel_version 5.15.0-56-generic
supermin: kernel: modpath /lib/modules/5.15.0-56-generic
cp: cannot open '/boot/vmlinuz-5.15.0-56-generic' for reading: Permission denied
supermin: cp -p '/boot/vmlinuz-5.15.0-56-generic' '/var/tmp/.guestfs-1000/appliance.d.tjwxgdef/kernel': command failed, see earlier errors
libguestfs: error: /usr/bin/supermin exited with error status 1, see debug messages above
libguestfs: trace: launch = -1 (error)
libguestfs: trace: close
libguestfs: closing guestfs handle 0x55ef3cce8040 (state 0)
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfs6ruxy0
Also, I don't know if this is needed, but here's the error output when I try to directly run the command:
virt-customize: error: libguestfs error: guestfs_launch failed.
This usually means the libguestfs appliance failed to start or crashed.
Do:
export LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1
and run the command again. For further information, read:
http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs
You can also run 'libguestfs-test-tool' and post the *complete* output
into a bug report or message to the libguestfs mailing list.
If reporting bugs, run virt-customize with debugging enabled and include
the complete output:
virt-customize -v -x [...]
2 years
Libguestfs Issue
by Le, Helen
1. Trying to run this command to use RHEL VM on Ubuntu VM: sudo virt-customize -a rhel-baseos-9.0-aarch64-kvm.qcow2 --root-password password:root
2. see above
3. attached below
[ 0.0] Examining the guest ...
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: trace: set_network true
libguestfs: trace: set_network = 0
libguestfs: trace: add_drive "rhel-baseos-9.0-aarch64-kvm.qcow2" "readonly:false" "protocol:file" "discard:besteffort"
libguestfs: trace: add_drive = 0
libguestfs: trace: launch
libguestfs: trace: max_disks
libguestfs: trace: max_disks = 255
libguestfs: trace: get_tmpdir
libguestfs: trace: get_tmpdir = "/tmp"
libguestfs: trace: version
libguestfs: trace: version = <struct guestfs_version = major: 1, minor: 40, release: 2, extra: , >
libguestfs: trace: get_backend
libguestfs: trace: get_backend = "direct"
libguestfs: launch: program=virt-customize
libguestfs: launch: version=1.40.2
libguestfs: launch: backend registered: unix
libguestfs: launch: backend registered: uml
libguestfs: launch: backend registered: libvirt
libguestfs: launch: backend registered: direct
libguestfs: launch: backend=direct
libguestfs: launch: tmpdir=/tmp/libguestfsCnrfDQ
libguestfs: launch: umask=0022
libguestfs: launch: euid=0
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/var/tmp"
libguestfs: begin building supermin appliance
libguestfs: run supermin
libguestfs: command: run: /usr/bin/supermin
libguestfs: command: run: \ --build
libguestfs: command: run: \ --verbose
libguestfs: command: run: \ --if-newer
libguestfs: command: run: \ --lock /var/tmp/.guestfs-0/lock
libguestfs: command: run: \ --copy-kernel
libguestfs: command: run: \ -f ext2
libguestfs: command: run: \ --host-cpu x86_64
libguestfs: command: run: \ /usr/lib/x86_64-linux-gnu/guestfs/supermin.d
libguestfs: command: run: \ -o /var/tmp/.guestfs-0/appliance.d
supermin: version: 5.1.20
supermin: package handler: debian/dpkg
supermin: acquiring lock on /var/tmp/.guestfs-0/lock
supermin: if-newer: output does not need rebuilding
libguestfs: finished building supermin appliance
libguestfs: begin testing qemu features
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/var/tmp"
libguestfs: checking for previously cached test results of /usr/bin/qemu-system-x86_64, in /var/tmp/.guestfs-0
libguestfs: loading previously cached test results
libguestfs: qemu version: 4.2
libguestfs: qemu mandatory locking: yes
libguestfs: qemu KVM: disabled
libguestfs: trace: get_backend_setting "force_tcg"
libguestfs: trace: get_backend_setting = NULL (error)
libguestfs: trace: get_sockdir
libguestfs: trace: get_sockdir = "/tmp"
libguestfs: finished testing qemu features
libguestfs: trace: get_backend_setting "gdb"
libguestfs: trace: get_backend_setting = NULL (error)
libguestfs: command: run: dmesg | grep -Eoh 'lpj=[[:digit:]]+'
libguestfs: read_lpj_from_dmesg: calculated lpj=9984000
/usr/bin/qemu-system-x86_64 \
-global virtio-blk-pci.scsi=off \
-no-user-config \
-enable-fips \
-nodefaults \
-display none \
-machine accel=kvm:tcg \
-m 768 \
-no-reboot \
-rtc driftfix=slew \
-no-hpet \
-global kvm-pit.lost_tick_policy=discard \
-kernel /var/tmp/.guestfs-0/appliance.d/kernel \
-initrd /var/tmp/.guestfs-0/appliance.d/initrd \
-object rng-random,filename=/dev/urandom,id=rng0 \
-device virtio-rng-pci,rng=rng0 \
-device virtio-scsi-pci,id=scsi \
-drive file=/home/hele/rhel-baseos-9.0-aarch64-kvm.qcow2,cache=writeback,discard=unmap,id=hd0,if=none \
-device scsi-hd,drive=hd0 \
-drive file=/var/tmp/.guestfs-0/appliance.d/root,snapshot=on,id=appliance,cache=unsafe,if=none,format=raw \
-device scsi-hd,drive=appliance \
-device virtio-serial-pci \
-serial stdio \
-device sga \
-chardev socket,path=/tmp/libguestfsQxT9yT/guestfsd.sock,id=channel0 \
-device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \
-netdev user,id=usernet,net=169.254.0.0/16 \
-device virtio-net-pci,netdev=usernet \
-append "panic=1 console=ttyS0 edd=off udevtimeout=6000 udev.event-timeout=6000 no_timer_check lpj=9984000 printk.time=1 cgroup_disable=memory usbcore.nousb cryptomgr.notests tsc=reliable 8250.nr_uarts=1 root=/dev/sdb selinux=0 guestfs_verbose=1 guestfs_network=1 TERM=xterm-256color"
qemu-system-x86_64: -drive file=/home/hele/rhel-baseos-9.0-aarch64-kvm.qcow2,cache=writeback,discard=unmap,id=hd0,if=none: Failed to get "write" lock
Is another process using the image [/home/hele/rhel-baseos-9.0-aarch64-kvm.qcow2]?
libguestfs: child_cleanup: 0x5642ddfad9e0: child process died
libguestfs: sending SIGTERM to process 55563
libguestfs: trace: launch = -1 (error)
virt-customize: error: libguestfs error: guestfs_launch failed, see earlier
error messages
libguestfs: trace: close
libguestfs: closing guestfs handle 0x5642ddfad9e0 (state 0)
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfsCnrfDQ
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfsQxT9yT
Also, I don't know if this is needed, but here's the error output when I try to directly run the command:
virt-customize: error: libguestfs error: guestfs_launch failed.
This usually means the libguestfs appliance failed to start or crashed.
Do:
export LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1
and run the command again. For further information, read:
http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs
You can also run 'libguestfs-test-tool' and post the *complete* output
into a bug report or message to the libguestfs mailing list.
If reporting bugs, run virt-customize with debugging enabled and include
the complete output:
virt-customize -v -x [...]
Thank you,
Helen Le
Robotics Engineering & Computer Science
Worcester Polytechnic Institute '23
hyle(a)wpi.edu | 2067340015
[cid:30c91dd4-2f61-4c32-ac4a-347c7640394b]
2 years
[v2v PATCH] convert_linux: add Rocky Linux to supported distros
by Andrey Drobyshev
Libguestfs commit 631962c0e88 ("Add detection support for Rocky Linux
(CentOS/RHEL-like)") introduced Rocky support, so now inspector returns
"rocky" in its i_distro field instead of just "redhat-based". virt-v2v
knows nothing about it, so when converting a Rocky guest we get en
error:
virt-v2v-in-place: error: virt-v2v is unable to convert this guest type
(linux/rocky)
Let's fix that by adding "rocky" as an acceptable value.
Signed-off-by: Andrey Drobyshev <andrey.drobyshev(a)virtuozzo.com>
---
convert/convert.ml | 2 +-
convert/convert_linux.ml | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/convert/convert.ml b/convert/convert.ml
index 17a75e3f..8d62f6d4 100644
--- a/convert/convert.ml
+++ b/convert/convert.ml
@@ -228,7 +228,7 @@ and do_convert g source inspect keep_serial_console interfaces =
| { i_type = "linux";
i_distro = ("fedora"
| "rhel" | "centos" | "scientificlinux" | "redhat-based"
- | "oraclelinux"
+ | "oraclelinux" | "rocky"
| "sles" | "suse-based" | "opensuse"
| "altlinux"
| "debian" | "ubuntu" | "linuxmint" | "kalilinux") } ->
diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml
index cde3b037..41767e62 100644
--- a/convert/convert_linux.ml
+++ b/convert/convert_linux.ml
@@ -50,7 +50,7 @@ let convert (g : G.guestfs) source inspect keep_serial_console _ =
match inspect.i_distro with
| "fedora"
| "rhel" | "centos" | "scientificlinux" | "redhat-based"
- | "oraclelinux" -> `RHEL_family
+ | "oraclelinux" | "rocky" -> `RHEL_family
| "altlinux" -> `ALT_family
| "sles" | "suse-based" | "opensuse" -> `SUSE_family
| "debian" | "ubuntu" | "linuxmint" | "kalilinux" -> `Debian_family
@@ -69,7 +69,7 @@ let convert (g : G.guestfs) source inspect keep_serial_console _ =
let qga_svc_start_cmd family distro major =
match family, distro, major with
| `RHEL_family, ( "rhel" | "centos" | "scientificlinux" | "redhat-based" |
- "oraclelinux" ), 6 ->
+ "oraclelinux" | "rocky" ), 6 ->
(* https://bugzilla.redhat.com/show_bug.cgi?id=2028764#c52 *)
Some "service qemu-ga start"
@@ -184,8 +184,8 @@ let convert (g : G.guestfs) source inspect keep_serial_console _ =
*)
(match inspect.i_distro, inspect.i_major_version with
| "fedora", _ -> Q35
- | ("rhel"|"centos"|"scientificlinux"|"redhat-based"|"oraclelinux"),
- major ->
+ | ("rhel"|"centos"|"scientificlinux"|"redhat-based"|"oraclelinux"|
+ "rocky"), major ->
if major <= 4 then I440FX else Q35
| ("sles"|"suse-based"|"opensuse"), major ->
if major < 10 then I440FX else Q35
--
2.31.1
2 years
[PATCH] m4/guestfs-appliance.m4: add VIRTUOZZO to RedHat-based distros
by Andrey Drobyshev
This allows to detect VzLinux guest.
Signed-off-by: Pavel Butsykin <pbutsykin(a)virtuozzo.com>
Signed-off-by: Andrey Drobyshev <andrey.drobyshev(a)virtuozzo.com>
---
m4/guestfs-appliance.m4 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/m4/guestfs-appliance.m4 b/m4/guestfs-appliance.m4
index 16ab3212d..3b97825c4 100644
--- a/m4/guestfs-appliance.m4
+++ b/m4/guestfs-appliance.m4
@@ -115,7 +115,7 @@ if test "x$ENABLE_APPLIANCE" = "xyes"; then
)"
AS_CASE([$DISTRO],
[FEDORA | RHEL | CENTOS | ALMALINUX | CLOUDLINUX \
- | ROCKY],
+ | ROCKY | VIRTUOZZO],
[DISTRO=REDHAT],
[OPENSUSE* | SLED | SLES],[DISTRO=SUSE],
[ARCH | MANJARO | ARTIX],[DISTRO=ARCHLINUX],
--
2.38.1
2 years
[PATCH libguestfs 0/2] lib: Return correct osinfo field for Windows 11
by Richard W.M. Jones
https://bugzilla.redhat.com/show_bug.cgi?id=2012658
We don't currently detect the correct version for Windows 11 (client,
server is OK). After some discussion it turns out the accepted way to
do this is to look at the Windows build ID.
So add some code in the daemon to grab the build ID from the
Windows registry and expose it through a new API ("guestfs_inspect_get_build_id")
and adjust the osinfo code on the library side accordingly.
Because, at least in theory, Linux distros could have build IDs, I
didn't call the API "guestfs_inspect_windows_...". There is a
possible build ID field in /etc/os-release, although it seems to be
unloved.
This fixes the <osinfo> field. I intentionally did not adjust either
the Windows version (still 10.0) nor the product name (which is
completely bogus, but apparently how Microsoft intended it to be).
Rich.
2 years
[PATCH v2v] convert: windows: Copy drivers for Windows 11, Windows 2019 & Windows 2022
by Richard W.M. Jones
If the virtio-win ISO contains drivers for Windows 11, Windows 2019 or
Windows 2022, and the guest matches these, then copy in the right
drivers. For this to work you will need libguestfs >= 1.49.8 which
allows osinfo to be used to detect Windows versions >= 10.
Side note: virtio-win uses a mix of different path element styles.
In the exploded tree of drivers installed by the RPM:
/usr/share/virtio-win/drivers/amd64$ ls -l
total 0
drwxr-xr-x. 2 root root 174 Nov 30 13:28 Win10
drwxr-xr-x. 2 root root 174 Nov 30 13:28 Win11
drwxr-xr-x. 2 root root 236 Nov 30 13:28 Win2008R2
drwxr-xr-x. 2 root root 174 Nov 30 13:28 Win2012
drwxr-xr-x. 2 root root 174 Nov 30 13:28 Win2012R2
drwxr-xr-x. 2 root root 174 Nov 30 13:28 Win2016
drwxr-xr-x. 2 root root 174 Nov 30 13:28 Win2019
drwxr-xr-x. 2 root root 174 Nov 30 13:28 Win2022
drwxr-xr-x. 2 root root 236 Nov 30 13:28 Win7
drwxr-xr-x. 2 root root 174 Nov 30 13:28 Win8
drwxr-xr-x. 2 root root 174 Nov 30 13:28 Win8.1
Inside the ISO:
><fs> ll /viostor/
total 28
dr-xr-xr-x 1 root root 2048 Jun 14 2020 2k12
dr-xr-xr-x 1 root root 2048 Jun 14 2020 2k12R2
dr-xr-xr-x 1 root root 2048 Jun 14 2020 2k16
dr-xr-xr-x 1 root root 2048 Jun 14 2020 2k19
dr-xr-xr-x 1 root root 2048 Dec 11 2021 2k22
dr-xr-xr-x 1 root root 2048 Jun 14 2020 2k8R2
dr-xr-xr-x 1 root root 2048 Jun 14 2020 w10
dr-xr-xr-x 1 root root 2048 Dec 11 2021 w11
dr-xr-xr-x 1 root root 2048 Jun 14 2020 w7
dr-xr-xr-x 1 root root 2048 Jun 14 2020 w8
dr-xr-xr-x 1 root root 2048 Jun 14 2020 w8.1
So I have matched both path elements.
Reported-by: Tingting Zheng
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2149811
---
convert/windows_virtio.ml | 45 +++++++++++++++++++++++----------------
1 file changed, 27 insertions(+), 18 deletions(-)
diff --git a/convert/windows_virtio.ml b/convert/windows_virtio.ml
index a27cd6a543..3156694d11 100644
--- a/convert/windows_virtio.ml
+++ b/convert/windows_virtio.ml
@@ -50,9 +50,9 @@ let rec install_drivers ((g, _) as reg) inspect =
g#mkdir_p driverdir;
if not (copy_drivers g inspect driverdir) then (
- warning (f_"there are no virtio drivers available for this version of Windows (%d.%d %s %s). virt-v2v looks for drivers in %s\n\nThe guest will be configured to use slower emulated devices.")
+ warning (f_"there are no virtio drivers available for this version of Windows (%d.%d %s %s %s). virt-v2v looks for drivers in %s\n\nThe guest will be configured to use slower emulated devices.")
inspect.i_major_version inspect.i_minor_version inspect.i_arch
- inspect.i_product_variant virtio_win;
+ inspect.i_product_variant inspect.i_osinfo virtio_win;
(IDE, RTL8139, false, false, false, false)
)
else (
@@ -279,7 +279,8 @@ and copy_from_virtio_win g inspect srcdir destdir filter missing =
*)
and virtio_iso_path_matches_guest_os path inspect =
let { i_major_version = os_major; i_minor_version = os_minor;
- i_arch = arch; i_product_variant = os_variant } = inspect in
+ i_arch = arch; i_product_variant = os_variant;
+ i_osinfo = osinfo } = inspect in
try
(* Lowercased path, since the ISO may contain upper or lowercase path
* elements.
@@ -300,37 +301,45 @@ and virtio_iso_path_matches_guest_os path inspect =
let is_client os_variant = os_variant = "Client"
and not_client os_variant = os_variant <> "Client"
- and any_variant os_variant = true in
- let p_os_major, p_os_minor, match_os_variant =
+ and any_variant os_variant = true
+ and any_osinfo osinfo = true in
+ let p_os_major, p_os_minor, match_os_variant, match_osinfo =
if pathelem "xp" || pathelem "winxp" then
- (5, 1, any_variant)
+ (5, 1, any_variant, any_osinfo)
else if pathelem "2k3" || pathelem "win2003" then
- (5, 2, any_variant)
+ (5, 2, any_variant, any_osinfo)
else if pathelem "vista" then
- (6, 0, is_client)
+ (6, 0, is_client, any_osinfo)
else if pathelem "2k8" || pathelem "win2008" then
- (6, 0, not_client)
+ (6, 0, not_client, any_osinfo)
else if pathelem "w7" || pathelem "win7" then
- (6, 1, is_client)
+ (6, 1, is_client, any_osinfo)
else if pathelem "2k8r2" || pathelem "win2008r2" then
- (6, 1, not_client)
+ (6, 1, not_client, any_osinfo)
else if pathelem "w8" || pathelem "win8" then
- (6, 2, is_client)
+ (6, 2, is_client, any_osinfo)
else if pathelem "2k12" || pathelem "win2012" then
- (6, 2, not_client)
+ (6, 2, not_client, any_osinfo)
else if pathelem "w8.1" || pathelem "win8.1" then
- (6, 3, is_client)
+ (6, 3, is_client, any_osinfo)
else if pathelem "2k12r2" || pathelem "win2012r2" then
- (6, 3, not_client)
+ (6, 3, not_client, any_osinfo)
else if pathelem "w10" || pathelem "win10" then
- (10, 0, is_client)
+ (10, 0, is_client, ((=) "win10"))
+ else if pathelem "w11" || pathelem "win11" then
+ (10, 0, is_client, ((=) "win11"))
else if pathelem "2k16" || pathelem "win2016" then
- (10, 0, not_client)
+ (10, 0, not_client, ((=) "win2k16"))
+ else if pathelem "2k19" || pathelem "win2019" then
+ (10, 0, not_client, ((=) "win2k19"))
+ else if pathelem "2k22" || pathelem "win2022" then
+ (10, 0, not_client, ((=) "win2k22"))
else
raise Not_found in
arch = p_arch && os_major = p_os_major && os_minor = p_os_minor &&
- match_os_variant os_variant
+ match_os_variant os_variant &&
+ match_osinfo osinfo
with Not_found -> false
--
2.37.3
2 years
[PATCH guestfs-tools] inspector: Display the new build ID field
by Richard W.M. Jones
libguestfs 1.49.8 adds a new API to read the build ID from guests
(especially for Windows). If the new API is available and if it
returns a string other than "unknown", then print it in virt-inspector
output.
---
inspector/inspector.c | 8 ++++++++
inspector/virt-inspector.rng | 1 +
2 files changed, 9 insertions(+)
diff --git a/inspector/inspector.c b/inspector/inspector.c
index 2702e3310c..e4b031149b 100644
--- a/inspector/inspector.c
+++ b/inspector/inspector.c
@@ -447,6 +447,14 @@ output_root (xmlTextWriterPtr xo, char *root)
single_element ("hostname", str);
free (str);
+#ifdef GUESTFS_HAVE_INSPECT_GET_BUILD_ID
+ str = guestfs_inspect_get_build_id (g, root);
+ if (!str) exit (EXIT_FAILURE);
+ if (STRNEQ (str, "unknown"))
+ single_element ("build_id", str);
+ free (str);
+#endif
+
str = guestfs_inspect_get_osinfo (g, root);
if (!str) exit (EXIT_FAILURE);
if (STRNEQ (str, "unknown"))
diff --git a/inspector/virt-inspector.rng b/inspector/virt-inspector.rng
index 5b460b3645..29c5798e19 100644
--- a/inspector/virt-inspector.rng
+++ b/inspector/virt-inspector.rng
@@ -38,6 +38,7 @@
<optional><ref name="ospackageformat"/></optional>
<optional><ref name="ospackagemanagement"/></optional>
<optional><element name="hostname"><text/></element></optional>
+ <optional><element name="build_id"><text/></element></optional>
<optional><element name="osinfo"><text/></element></optional>
<ref name="mountpoints"/>
--
2.37.3
2 years
[PATCH v2v] rhv: Use osinfo to distinguish Windows >= 10 variants
by Richard W.M. Jones
Windows versions >= 10 no longer use the NT major.minor numbering
scheme (it is fixed at 10.0). Libguestfs >= 1.49.8 can distinguish
these versions and it sets <osinfo> correctly, so use that instead.
After this change the OVF will contain:
<Info>Windows 10 Pro</Info>
<Description>windows_11</Description>
which is strange, but apparently what Microsoft intended. As far as
RHV is concern it only needs the <Description> to be correct in order
to choose the correct devices etc.
Reported-by: Tingting Zheng
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2149863
---
lib/create_ovf.ml | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/lib/create_ovf.ml b/lib/create_ovf.ml
index 18e86d6cf1..8aff3d8f0b 100644
--- a/lib/create_ovf.ml
+++ b/lib/create_ovf.ml
@@ -231,13 +231,22 @@ and get_ostype = function
i_arch = "i386" } ->
"windows_10"
+ (* For Windows NT 10.0 always use the <osinfo> field since the
+ * other fields will not accurately reflect the version.
+ *)
| { i_type = "windows"; i_major_version = 10; i_minor_version = 0;
- i_arch = "x86_64"; i_product_variant = "Client" } ->
- "windows_10x64"
-
- | { i_type = "windows"; i_major_version = 10; i_minor_version = 0;
- i_arch = "x86_64" } ->
- "windows_2016x64"
+ i_arch = "x86_64"; i_osinfo = osinfo; i_product_name = product } ->
+ (match osinfo with
+ | "win10" -> "windows_10x64"
+ | "win11" -> "windows_11"
+ | "win2k16" -> "windows_2016x64"
+ | "win2k19" -> "windows_2019x64"
+ | "win2k22" -> "windows_2022"
+ | _ ->
+ warning (f_"unknown Windows 10 variant: %s (%s)")
+ osinfo product;
+ "windows_2022"
+ )
| { i_type = typ; i_distro = distro;
i_major_version = major; i_minor_version = minor; i_arch = arch;
--
2.37.3
2 years