[pve-devel] [PATCH v4 qemu-server 2/12] qemuserver: foreach_volid: include pending volumes

Fiona Ebner f.ebner at proxmox.com
Fri Jun 16 14:25:13 CEST 2023


Am 16.06.23 um 11:56 schrieb Aaron Lauterer:
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 6cbaf87..33acef6 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -2424,7 +2424,7 @@ sub destroy_vm {
>  
>      if ($purge_unreferenced) { # also remove unreferenced disk
>  	my $vmdisks = PVE::Storage::vdisk_list($storecfg, undef, $vmid, undef, 'images');
> -	PVE::Storage::foreach_volid($vmdisks, sub {
> +	PVE::Storage::foreach_volid($vmdisks, 1, sub {

This is a different function.

>  	    my ($volid, $sid, $volname, $d) = @_;
>  	    eval { PVE::Storage::vdisk_free($storecfg, $volid) };
>  	    warn $@ if $@;

(...)

> @@ -4902,6 +4904,11 @@ sub foreach_volid {
>      };
>  
>      PVE::QemuConfig->foreach_volume_full($conf, $include_opts, $test_volid);
> +
> +    if ($include_pending && defined($conf->{pending}) && $conf->{pending}->%*) {
> +	PVE::QemuConfig->foreach_volume_full($conf->{pending}, $include_opts, $test_volid, undef, 1);
> +    }

Style nit: wouldn't be 101 chars as a post-if ;)

> +
>      foreach my $snapname (keys %{$conf->{snapshots}}) {
>  	my $snap = $conf->{snapshots}->{$snapname};
>  	PVE::QemuConfig->foreach_volume_full($snap, $include_opts, $test_volid, $snapname);






More information about the pve-devel mailing list