[pve-devel] [PATCH v2 qemu-server] fix 4493: cloud-init: fix generated Windows config

Mira Limbeck m.limbeck at proxmox.com
Tue Jul 30 10:12:13 CEST 2024


On 7/29/24 19:22, Thomas Lamprecht wrote:
> Am 29/07/2024 um 17:19 schrieb Mira Limbeck:
>> cloudbase-init, a cloud-init reimplementation for Windows, supports only
>> a subset of the configuration options of cloud-init. Some features
>> depend on support by the Metadata Service (ConfigDrive2 here) and have
>> further limitations [0].
>>
>> To support a basic setup the following changes were made:
>>  - password is saved as plaintext for any Windows guests (ostype)
>>  - DNS servers are added to each of the interfaces
>>  - SSH public keys are passed via metadata
>>
>> Network and metadata generation for cloudbase-init is separate from the
>> default ConfigDrive2 one so as to not interfere with any other OSes that
>> depend on the current ConfigDrive2 implementation.
>>
>> [0] https://cloudbase-init.readthedocs.io/en/latest/index.html
>>
>> Signed-off-by: Mira Limbeck <m.limbeck at proxmox.com>
>> ---
>> v2:
>>  - unchanged
>>
>> v1:
>>
>> DNS search domains are not handled at all by the cloudbase-init ENI
>> parser.
>> The password is used for the Admin user specified in the
>> cloudbase-init.conf inside the guest. Specifying a different user does
>> not work. This would require rewriting the userdata handling as
>> described in #5384 [1] which is a breaking change. Userdata generation
>> is currently shared between all implementations, but the new one could
>> be made cloudbase-init only for now.
>>
>> To know if the password needs to be unencrypted, we have to check the
>> `ostype`. For this we need access to the config. That's why I moved the
>> `cipassword` handling inside $updatefn.
>>
>> When no `citype` is specified, it will default to `configdrive2` on
>> Windows. The check requires `ostype` to be set correctly.
>> Any other `citype`s may not work correctly if used for cloudbase-init.
>>
>> The docs patch adds a section on how to configure a Windows guest for
>> cloudbase-init.
> 
> certainly not a clear-cut, but IMO most above might be even fine for the
> commit message as (advanced) background and hints for future dev/support
> engineers debugging CI on windows.
> 
Since a v3 is required for the docs patch, I'll add those parts to the
commit message in a v3.

>  
>> diff --git a/PVE/QemuServer/Cloudinit.pm b/PVE/QemuServer/Cloudinit.pm
>> index abc6b14..d4ecfac 100644
>> --- a/PVE/QemuServer/Cloudinit.pm
>> +++ b/PVE/QemuServer/Cloudinit.pm
>> @@ -8,6 +8,8 @@ use Digest::SHA;
>>  use URI::Escape;
>>  use MIME::Base64 qw(encode_base64);
>>  use Storable qw(dclone);
>> +use JSON;
>> +use URI;
> 
> Using that module would need adding `liburi-perl` as dependency, and I did not check
> closely but quite probably also as build-dependency.
> 
> I can fleece that in on applying though, but I'd like some T-b tag (and would naturally
> appreciate any R-b one) before applying this one.
> 
I just noticed, we already have a `use URI::Escape` which is all that's
needed for the changes here, so adding `use URI` is not required.
I'll check and add the liburi-perl dependency in a v3 then.

Thanks!




More information about the pve-devel mailing list