Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Report correct guest UUID, when VM Generation 2 is used #421

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jirihnidek
Copy link
Collaborator

@jirihnidek jirihnidek commented Feb 6, 2025

* Card ID: CCT-676
* When VM is created as Generation 2 in the setup wizard of
  Hyper-V hypervisor, then hypervisor reports UUID of given
  VM using little-endian. Thus it is not necessary to
  convert this UUID as we do for Generation 1.
* We solve this issue by extending SQL query. We also ask
  for VirtualSystemSubType, which contains version of VM
  generation ("Microsoft:Hyper-V:SubType:1" or
  "Microsoft:Hyper-V:SubType:2"). When VM is generation 1,
  then we convert UUID from big-endian to little-endian
  as we have did it in the past. When generation is 2 and
  major version of Hyper-V vmms is greater than 10, then
  we do nothing with guest UUID.
* Changed code around little bit, because there was variable
  uuid used for different purpose and it was confusing.
* TODO: hyperv.py deserves more refactoring
* More information about generation 1 or 2 on Hyper-V could be
  found e.g. here:
  * https://learn.microsoft.com/en-us/windows-server/virtualization/hyper-v/get-started/create-a-virtual-machine-in-hyper-v
  * https://learn.microsoft.com/en-us/windows-server/virtualization/hyper-v/plan/should-i-create-a-generation-1-or-2-virtual-machine-in-hyper-v
if gen_version is None or gen_version == self.GEN_VERSION_1:
return s[6:8] + s[4:6] + s[2:4] + s[0:2] + "-" + s[11:13] + s[9:11] + "-" + s[16:18] + s[14:16] + s[18:]
elif gen_version == self.GEN_VERSION_2:
if vmms_major_ver <= 10:
Copy link
Collaborator Author

@jirihnidek jirihnidek Feb 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to know the right value of this threshold. The value 10 is only estimation.

@jirihnidek jirihnidek marked this pull request as draft February 13, 2025 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant