-
Notifications
You must be signed in to change notification settings - Fork 775
[qemu-proc-spec] Add -uuid to the arguments
#4733
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,7 +38,6 @@ mp::QemuVMProcessSpec::QemuVMProcessSpec(const mp::VirtualMachineDescription& de | |
| QStringList mp::QemuVMProcessSpec::arguments() const | ||
| { | ||
| QStringList args; | ||
|
|
||
| if (resume_data) | ||
| { | ||
| args = resume_data->arguments; | ||
|
|
@@ -63,10 +62,12 @@ QStringList mp::QemuVMProcessSpec::arguments() const | |
| } | ||
| else | ||
| { | ||
| // The UUID needs to be unique per VM and must be consistent across boots. | ||
| const auto vm_uuid = utils::make_uuid(desc.vm_name); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A few questions regarding effects on clones:
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes. It should be treated as any other instance-unique field.
Yes, it is abstracted from the disk contents. In reality, it's a hardware serial-like info burned into the BIOS by the manufacturer. No disk involvement at all.
The |
||
| auto mem_size = | ||
| QString::number(desc.mem_size.in_megabytes()) + 'M'; /* flooring here; format documented | ||
| in `man qemu-system`, under `-m` option; including suffix to avoid relying on default unit */ | ||
|
|
||
| // clang-format off | ||
| args << platform_args; | ||
| // The VM image itself | ||
| args << "-device" | ||
|
|
@@ -97,6 +98,9 @@ in `man qemu-system`, under `-m` option; including suffix to avoid relying on de | |
| << "-nographic"; | ||
| // Cloud-init disk | ||
| args << "-cdrom" << desc.cloud_init_iso; | ||
| // To make `/sys/class/dmi/id/product_uuid` present | ||
| args << "-uuid" << vm_uuid; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To implement instance renaming, we'll probably want to keep the UUID stable. We'd probably save it along with other instance metadata, right? Do you foresee any impediment doing that? Just to be sure.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That should be sufficient if we update the UUID on clone. I can't think of any potential gotchas on that. |
||
| // clang-format on | ||
| } | ||
|
|
||
| for (const auto& [_, mount_data] : mount_args) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This covers only the QEMU backend. What happens in other backends? Is a name-based UUID available in the new Hyper-V and AppleVZ today? If not, that's probably worth some wider team awareness and synchronizing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be available for all off-the-shelf hypervisors already -- the existing hyper-v implementation already does that:
I don't know the specifics for Apple VZ, but I think there should be a way to set it, as it's a pretty common thing for hypervisors to do.
https://developer.apple.com/documentation/virtualization/vzgenericmachineidentifierlooks promising, maybe @sharder996 could confirm that. I'll check the new Hyper-V implementation to make sure that it's still available.