mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-01 04:11:00 +00:00
generate cloudinit drive on offline plug
Currently when only generate it at vm start Signed-off-by: Alexandre Derumier <aderumier@odiso.com> Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
95a5135dad
commit
c930f99e57
@ -5087,6 +5087,8 @@ sub vmconfig_apply_pending {
|
|||||||
|
|
||||||
PVE::QemuConfig->cleanup_pending($conf);
|
PVE::QemuConfig->cleanup_pending($conf);
|
||||||
|
|
||||||
|
my $generate_cloudnit = undef;
|
||||||
|
|
||||||
foreach my $opt (keys %{$conf->{pending}}) { # add/change
|
foreach my $opt (keys %{$conf->{pending}}) { # add/change
|
||||||
next if $opt eq 'delete'; # just to be sure
|
next if $opt eq 'delete'; # just to be sure
|
||||||
eval {
|
eval {
|
||||||
@ -5097,12 +5099,19 @@ sub vmconfig_apply_pending {
|
|||||||
if (my $err = $@) {
|
if (my $err = $@) {
|
||||||
$add_apply_error->($opt, $err);
|
$add_apply_error->($opt, $err);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if (is_valid_drivename($opt)) {
|
||||||
|
my $drive = parse_drive($opt, $conf->{pending}->{$opt});
|
||||||
|
$generate_cloudnit = 1 if drive_is_cloudinit($drive);
|
||||||
|
}
|
||||||
|
|
||||||
$conf->{$opt} = delete $conf->{pending}->{$opt};
|
$conf->{$opt} = delete $conf->{pending}->{$opt};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# write all changes at once to avoid unnecessary i/o
|
# write all changes at once to avoid unnecessary i/o
|
||||||
PVE::QemuConfig->write_config($vmid, $conf);
|
PVE::QemuConfig->write_config($vmid, $conf);
|
||||||
|
PVE::QemuServer::Cloudinit::generate_cloudinitconfig($conf, $vmid) if $generate_cloudnit;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub vmconfig_update_net {
|
sub vmconfig_update_net {
|
||||||
|
Loading…
Reference in New Issue
Block a user