From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: Manuel Federanko <m.federanko@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [PATCH qemu-server] fix #5578: smbios: set serial number
Date: Wed, 18 Feb 2026 17:24:14 +0100 [thread overview]
Message-ID: <20260218172414.79f1cc01@rosa.proxmox.com> (raw)
In-Reply-To: <20260218142935.99693-1-m.federanko@proxmox.com>
Thanks for tackling this!
comments/questions inline:
On Wed, 18 Feb 2026 15:29:35 +0100
Manuel Federanko <m.federanko@proxmox.com> wrote:
> If no smbios options are given on creation, default to generate a serial
> number. This is required for Windows Autopilot to identify a user
> device.
The commit message could include a few more details - explaining some
choices - e.g. - the bugzilla request suggest to use a (substring of) the
smbios UUID (which should be unique and thus maybe a ok choice for a
machine-serial number) as serial number - why did you chose to generate
another random string? (if possible re-using parts of the uuid would sound
elegant to me)
>
> Signed-off-by: Manuel Federanko <m.federanko@proxmox.com>
> ---
> src/PVE/API2/Qemu.pm | 5 ++++-
> src/PVE/CLI/qm.pm | 5 ++++-
> src/PVE/QemuServer.pm | 6 ++++++
> 3 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm
> index c2e185a6..8d1e3ec0 100644
> --- a/src/PVE/API2/Qemu.pm
> +++ b/src/PVE/API2/Qemu.pm
> @@ -1471,7 +1471,10 @@ __PACKAGE__->register_method({
>
> # auto generate uuid if user did not specify smbios1 option
> if (!$conf->{smbios1}) {
> - $conf->{smbios1} = PVE::QemuServer::generate_smbios1_uuid();
> + $conf->{smbios1} =
> + PVE::QemuServer::generate_smbios1_uuid() . ","
> + . PVE::QemuServer::generate_smbios1_serial()
> + . ",base64=1";
why add the base64 here - the commit introducing it mentions embedded
nul-bytes:
> }
>
> if (
> diff --git a/src/PVE/CLI/qm.pm b/src/PVE/CLI/qm.pm
> index bdae9641..44c74eed 100755
> --- a/src/PVE/CLI/qm.pm
> +++ b/src/PVE/CLI/qm.pm
> @@ -912,7 +912,10 @@ __PACKAGE__->register_method({
> eval {
> # order matters, as do_import() will load_config() internally
> $conf->{vmgenid} = PVE::QemuServer::generate_uuid();
> - $conf->{smbios1} = PVE::QemuServer::generate_smbios1_uuid();
> + $conf->{smbios1} =
> + PVE::QemuServer::generate_smbios1_uuid() . ","
> + . PVE::QemuServer::generate_smbios1_serial()
> + . ",base64=1";
> PVE::QemuConfig->write_config($vmid, $conf);
>
> foreach my $disk (@{ $parsed->{disks} }) {
> diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
> index 545758dc..a8cc7d85 100644
> --- a/src/PVE/QemuServer.pm
> +++ b/src/PVE/QemuServer.pm
> @@ -8086,6 +8086,12 @@ sub generate_smbios1_uuid {
> return "uuid=" . generate_uuid();
> }
>
> +sub generate_smbios1_serial {
> + my @population = ('0' .. '9', 'A' .. 'Z', 'a' .. 'z');
> + my $serial = join('', map($population[rand(@population)], 1 .. 12));
> + return "serial=" . encode_base64($serial, "");
> +}
> +
> sub create_reboot_request {
> my ($vmid) = @_;
> open(my $fh, '>', "/run/qemu-server/$vmid.reboot")
next prev parent reply other threads:[~2026-02-18 16:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-18 14:29 Manuel Federanko
2026-02-18 16:24 ` Stoiko Ivanov [this message]
2026-02-18 16:33 ` Stoiko Ivanov
2026-02-19 11:32 ` superseded: " Manuel Federanko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260218172414.79f1cc01@rosa.proxmox.com \
--to=s.ivanov@proxmox.com \
--cc=m.federanko@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox