Skip to content

Commit

Permalink
rhv: Use osinfo to distinguish Windows >= 10 variants
Browse files Browse the repository at this point in the history
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 concerned it only needs <Description> to choose the correct
devices etc.

Reported-by: Tingting Zheng
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2149863
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
  • Loading branch information
rwmjones committed Dec 2, 2022
1 parent 04ab492 commit 38b35f3
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions lib/create_ovf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 38b35f3

Please sign in to comment.