[pve-devel] pve-devel Digest, Vol 107, Issue 46

Austin Chan sptrsca at gmail.com
Mon Apr 15 05:12:30 CEST 2019


Hi,

We need few configuration on Windows.

https://pve.proxmox.com/pipermail/pve-devel/2019-April/036605.html <https://pve.proxmox.com/pipermail/pve-devel/2019-April/036605.html>

Please check the update in pve-docs.git.

These 4 changes are totally work for cloud-init Windows.

You have to configure few option on windows Cloudbase-init to make it read the metadata currently. 

The 'genisoimage' can be removed. But for the best practice, make the -ios-level to 3 will avoiding some unknow issues. 

Because the filesystem for ISO image disk will limit the punctuation mark, capital or not in file name and directory level.

Set it to level 3 will ignore this when generate the ISO file. 

For the password, IP and DNS, please look at the update in pve-docs.

I just install these patch in my produce environment. It works well. 



> On Apr 12, 2019, at 6:00 AM, pve-devel-request at pve.proxmox.com wrote:
> 
> Send pve-devel mailing list submissions to
> 	pve-devel at pve.proxmox.com
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> or, via email, send a message with subject or body 'help' to
> 	pve-devel-request at pve.proxmox.com
> 
> You can reach the person managing the list at
> 	pve-devel-owner at pve.proxmox.com
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of pve-devel digest..."
> 
> 
> Today's Topics:
> 
>   1. Re: [PATCH] Let PVE QEMU Cloud-Init adapt Cloudbase-init
>      (Mira Limbeck)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Fri, 12 Apr 2019 11:47:55 +0200
> From: Mira Limbeck <m.limbeck at proxmox.com>
> To: pve-devel at pve.proxmox.com
> Subject: Re: [pve-devel] [PATCH] Let PVE QEMU Cloud-Init adapt
> 	Cloudbase-init
> Message-ID: <a08d61ac-4ee8-02e1-3e2b-e3f32c70b03d at proxmox.com>
> Content-Type: text/plain; charset=utf-8; format=flowed
> 
> Hi,
> 
> Thank you for the patch. Looks like the patch still lacks a commit message.
> 
> It might also better to separate those 4 (almost) independent changes as 
> @Thomas mentioned yesterday.
> 
> For example first the 'genisoimage' patch as none of the others work 
> correctly without this patch? (At least based on my limited 
> cloudbase-init tests regarding static network configuration this is 
> necessary for cloudbase-init to recognize the iso correctly. Or do some 
> of the features work without this?)
> 
> 
> Some further comments inline.
> 
> 
> On 4/12/19 12:36 AM, Austin Chan wrote:
>> ---
>>  PVE/API2/Qemu.pm            |  8 ++++++--
>>  PVE/QemuServer/Cloudinit.pm | 13 +++++++++----
>>  2 files changed, 15 insertions(+), 6 deletions(-)
>> 
>> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
>> index 7195ec2..a591d7a 100644
>> --- a/PVE/API2/Qemu.pm
>> +++ b/PVE/API2/Qemu.pm
>> @@ -1020,10 +1020,14 @@ my $update_vm_api  = sub {
>> 
>>      my $background_delay = extract_param($param, 'background_delay');
>> 
>> +    my $ostype = PVE::QemuConfig->load_config($vmid)->{ostype};
>> +
>>      if (defined(my $cipassword = $param->{cipassword})) {
>>  	# Same logic as in cloud-init (but with the regex fixed...)
>> -	$param->{cipassword} = PVE::Tools::encrypt_pw($cipassword)
>> -	    if $cipassword !~ /^\$(?:[156]|2[ay])(\$.+){2}/;
>> +	if (!PVE::QemuServer::windows_version($ostype)) {
>> +	    $param->{cipassword} = PVE::Tools::encrypt_pw($cipassword)
>> +		if $cipassword !~ /^\$(?:[156]|2[ay])(\$.+){2}/;
>> +	}
>>      }
> I haven't gotten around to testing this yet, but I will as soon as I get 
> to it.
>> 
>>      my @paramarr = (); # used for log message
>> diff --git a/PVE/QemuServer/Cloudinit.pm b/PVE/QemuServer/Cloudinit.pm
>> index 445c777..4f39a2b 100644
>> --- a/PVE/QemuServer/Cloudinit.pm
>> +++ b/PVE/QemuServer/Cloudinit.pm
>> @@ -43,7 +43,7 @@ sub commit_cloudinit_disk {
>>      my $size = PVE::Storage::file_size_info($iso_path);
>> 
>>      eval {
>> -	run_command([['genisoimage', '-R', '-V', $label, $path],
>> +	run_command([['genisoimage','-iso-level', '3', '-R', '-V', $label, $path],
>>  		     ['qemu-img', 'dd', '-n', '-f', 'raw', '-O', $format,
>>  		      'isize=0', "osize=$size", "of=$iso_path"]]);
> This is a change that I made locally as well to test it last time, still 
> have to test it more thoroughly, but looks good so far.
>>      };
>> @@ -159,11 +159,11 @@ sub configdrive2_network {
>>      my ($searchdomains, $nameservers) = get_dns_conf($conf);
>>      if ($nameservers && @$nameservers) {
>>  	$nameservers = join(' ', @$nameservers);
>> -	$content .= "        dns_nameservers $nameservers\n";
>> +	$content .= "        dns-nameservers $nameservers\n";
>>      }
>>      if ($searchdomains && @$searchdomains) {
>>  	$searchdomains = join(' ', @$searchdomains);
>> -	$content .= "        dns_search $searchdomains\n";
>> +	$content .= "        dns-search $searchdomains\n";
>>      }
>> 
> 
> Tested this yesterday, still couldn't set any dns-nameservers. How did 
> you make it work? Which cloudbase-init config did you use and what did 
> you add in the PVE GUI?
> 
> ipv4 nameservers worked when I added them to the ipv4 network interfaces 
> directly instead of to 'lo', but ipv6 didn't work at all.
> 
>>      my @ifaces = grep(/^net(\d+)$/, keys %$conf);
>> @@ -203,9 +203,14 @@ sub configdrive2_network {
>> 
>>  sub configdrive2_metadata {
>>      my ($uuid) = @_;
>> +	my ($conf, $vmid, $uuid) = @_;
>> +	my ($hostname, $fqdn) = get_hostname_fqdn($conf, $vmid);
>> +	my $password = $conf->{cipassword};
>>      return <<"EOF";
>>  {
>>       "uuid": "$uuid",
>> +	 "hostname": "$hostname",
>> +	 "admin_pass": "$password",
>>       "network_config": { "content_path": "/content/0000" }
>>  }
>>  EOF
>> @@ -222,7 +227,7 @@ sub generate_configdrive2 {
>>  	my $digest_data = $user_data . $network_data;
>>  	my $uuid_str = Digest::SHA::sha1_hex($digest_data);
>> 
>> -	$meta_data = configdrive2_metadata($uuid_str);
>> +	$meta_data = configdrive2_metadata($conf, $vmid, $uuid_str);
>>      }
>>      my $files = {
>>  	'/openstack/latest/user_data' => $user_data,
> Same as above, haven't gotten around to testing this yet, but of course 
> will test it as soon as I get to it.
> 
> 
> 
> ------------------------------
> 
> Subject: Digest Footer
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> ------------------------------
> 
> End of pve-devel Digest, Vol 107, Issue 46
> ******************************************




More information about the pve-devel mailing list