sorry - sent too soon. further comments inline: On Wed, 18 Feb 2026 17:24:14 +0100 Stoiko Ivanov <[email protected]> wrote:
> Thanks for tackling this! > > comments/questions inline: > > On Wed, 18 Feb 2026 15:29:35 +0100 > Manuel Federanko <[email protected]> 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) also - how did you test this? - adding such information can go a long way to reproducing your results. > > > > > > Signed-off-by: Manuel Federanko <[email protected]> > > --- > > 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: https://git.proxmox.com/?p=qemu-server.git;a=commitdiff;h=1f30ac3a9f18c215d3e3c657f9e81d9d3125f46c I guess from a quick look that you need to change that part to add the uuid and the serial as separate keys to smbios1 (smbios1 is a property_string (a not deeply nested has stored as a string in our config file) - see https://git.proxmox.com/?p=pve-common.git;a=blob;f=src/PVE/JSONSchema.pm;h=17e7126a6c42f8326a1da890680af10b6106d906;hb=HEAD#l1041 > > > } > > > > 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") > > > > >
