Am 09.06.21 um 13:54 schrieb Alexandre Derumier: > Currently when only generate it at vm start > > Signed-off-by: Alexandre Derumier <aderum...@odiso.com> > --- > PVE/QemuServer.pm | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm > index 25ac052..6ddac72 100644 > --- a/PVE/QemuServer.pm > +++ b/PVE/QemuServer.pm > @@ -4776,6 +4776,8 @@ sub vmconfig_apply_pending { > > PVE::QemuConfig->cleanup_pending($conf); > > + my $generate_cloudnit = undef; > + > foreach my $opt (keys %{$conf->{pending}}) { # add/change > next if $opt eq 'delete'; # just to be sure > eval { > @@ -4783,6 +4785,12 @@ sub vmconfig_apply_pending { > vmconfig_register_unused_drive($storecfg, $vmid, $conf, > parse_drive($opt, $conf->{$opt})) > } > }; > + > + if (is_valid_drivename($opt)) { > + my $drive = parse_drive($opt, $conf->{pending}->{$opt}); > + $generate_cloudnit = 1 if drive_is_cloudinit($drive); > + }
This is bad, because it introduces code (and in particular function calls, which could contain another eval) between an eval and its error handling. > + > if (my $err = $@) { > $add_apply_error->($opt, $err); > } else { > @@ -4792,6 +4800,8 @@ sub vmconfig_apply_pending { > > # write all changes at once to avoid unnecessary i/o > PVE::QemuConfig->write_config($vmid, $conf); > + > + PVE::QemuServer::Cloudinit::generate_cloudinitconfig($conf, $vmid) if > $generate_cloudnit; > } > > sub vmconfig_update_net { _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel