[pve-devel] [PATCH qemu-server 1/3] use default hostname when none is set

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Mar 13 08:29:43 CET 2018


On 03/12/2018 04:25 PM, Dominik Csapak wrote:
> use "VM$vmid" like we do in a container
> 

series looks OK for me, but I let Wolfgang/Dietmar handle this,
CloudInit is fully theirs ;)

Reviewed-by: Thomas Lamprecht <t.lamprecht at proxmox.com>

Nit: could you please add a tag in front of the commit message,
for a series like this, which affects a specific subsystem of a repo
e.g.:

cloudinit: use default hostname when none is set

It helps a lot when looking through git log later, where you do
not always have the file change statistics available like here,
and even here it helps because one knows from the very first words
he reads what the patch is about :)
(this doesn't make always sense, but here it'd work great)

> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  PVE/QemuServer/Cloudinit.pm | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/PVE/QemuServer/Cloudinit.pm b/PVE/QemuServer/Cloudinit.pm
> index dc55d2d..31f8462 100644
> --- a/PVE/QemuServer/Cloudinit.pm
> +++ b/PVE/QemuServer/Cloudinit.pm
> @@ -63,8 +63,8 @@ sub get_cloudinit_format {
>  }
>  
>  sub get_hostname_fqdn {
> -    my ($conf) = @_;
> -    my $hostname = $conf->{name};
> +    my ($conf, $vmid) = @_;
> +    my $hostname = $conf->{name} // "VM$vmid";
>      my $fqdn;
>      if ($hostname =~ /\./) {
>  	$fqdn = $hostname;
> @@ -96,9 +96,9 @@ sub get_dns_conf {
>  }
>  
>  sub cloudinit_userdata {
> -    my ($conf) = @_;
> +    my ($conf, $vmid) = @_;
>  
> -    my ($hostname, $fqdn) = get_hostname_fqdn($conf);
> +    my ($hostname, $fqdn) = get_hostname_fqdn($conf, $vmid);
>  
>      my $content = "#cloud-config\n";
>  
> @@ -198,7 +198,7 @@ EOF
>  sub generate_configdrive2 {
>      my ($conf, $vmid, $drive, $volname, $storeid) = @_;
>  
> -    my $user_data = cloudinit_userdata($conf);
> +    my $user_data = cloudinit_userdata($conf, $vmid);
>      my $network_data = configdrive2_network($conf);
>  
>      my $digest_data = $user_data . $network_data;
> @@ -363,7 +363,7 @@ sub nocloud_metadata {
>  sub generate_nocloud {
>      my ($conf, $vmid, $drive, $volname, $storeid) = @_;
>  
> -    my $user_data = cloudinit_userdata($conf);
> +    my $user_data = cloudinit_userdata($conf, $vmid);
>      my $network_data = nocloud_network($conf);
>  
>      my $digest_data = $user_data . $network_data;
> 





More information about the pve-devel mailing list