[pve-devel] applied: [PATCH qemu-server] use the proper pending delete format while looping
Thomas Lamprecht
t.lamprecht at proxmox.com
Tue Oct 22 12:59:42 CEST 2019
On 10/22/19 12:34 PM, Oguz Bektas wrote:
> fixes a bug where 'detach' caused disks to be destroyed immediately,
> because $force parameter was always true since hash is true.
>
> Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
> ---
> PVE/QemuServer.pm | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 3408898..a054199 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -4856,7 +4856,8 @@ sub vmconfig_hotplug_pending {
> my $hotplug_features = parse_hotplug_features(defined($conf->{hotplug}) ? $conf->{hotplug} : '1');
>
> my $pending_delete_hash = PVE::QemuConfig->parse_pending_delete($conf->{pending}->{delete});
> - while (my ($opt, $force) = each %$pending_delete_hash) {
> + foreach my $opt (keys %$pending_delete_hash) {
> + my $force = $pending_delete_hash->{$opt}->{force};
> next if $selection && !$selection->{$opt};
> eval {
> if ($opt eq 'hotplug') {
> @@ -5054,8 +5055,9 @@ sub vmconfig_apply_pending {
> # cold plug
>
> my $pending_delete_hash = PVE::QemuConfig->parse_pending_delete($conf->{pending}->{delete});
> - while (my ($opt, $force) = each %$pending_delete_hash) {
> + foreach my $opt (keys %$pending_delete_hash) {
> die "internal error" if $opt =~ m/^unused/;
> + my $force = $pending_delete_hash->{$opt}->{force};
> $conf = PVE::QemuConfig->load_config($vmid); # update/reload
> if (!defined($conf->{$opt})) {
> PVE::QemuConfig->remove_from_pending_delete($conf, $opt);
>
applied, thanks!
More information about the pve-devel
mailing list