[pve-devel] [PATCH qemu-server] cloud-init: don't regenerate ssh hosts key on config change when vm is running

Mira Limbeck m.limbeck at proxmox.com
Wed Jan 13 12:26:28 CET 2021


We could add vendor data and put the ssh keys there:

https://cloudinit.readthedocs.io/en/latest/topics/vendordata.html


On 1/13/21 10:01 AM, Alexandre Derumier wrote:
> Currently, we always regenerate sshkeys on any config change.
>
> It should be done only before the first vm start, but currently can't known that.
>
> So, this patch only do it when vm is running.
>
> Signed-off-by: Alexandre Derumier<aderumier at odiso.com>
> ---
>   PVE/QemuServer/Cloudinit.pm | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/PVE/QemuServer/Cloudinit.pm b/PVE/QemuServer/Cloudinit.pm
> index 52a4203..dd643c1 100644
> --- a/PVE/QemuServer/Cloudinit.pm
> +++ b/PVE/QemuServer/Cloudinit.pm
> @@ -135,6 +135,8 @@ sub cloudinit_userdata {
>   	    $content .= "  - $k\n";
>   	}
>       }
> +    $content .= "ssh_deletekeys: false\n" if PVE::QemuServer::check_running($vmid);
> +
>       $content .= "chpasswd:\n";
>       $content .= "  expire: False\n";
>   




More information about the pve-devel mailing list