]> git.proxmox.com Git - qemu-server.git/commitdiff
foreach volid helper: make $pending parameter behave like a boolean
authorFiona Ebner <f.ebner@proxmox.com>
Wed, 21 Jun 2023 10:20:57 +0000 (12:20 +0200)
committerFiona Ebner <f.ebner@proxmox.com>
Wed, 21 Jun 2023 10:48:11 +0000 (12:48 +0200)
Avoids potential future mistake with passing in an explicit 0.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
PVE/QemuServer.pm

index df44e6fbfb3023f176e94d21e4e339375f494d61..430661a7af8c027d995f8cf0764aa6de512b9bb8 100644 (file)
@@ -4865,12 +4865,12 @@ sub foreach_volid {
 
        $volhash->{$volid}->{is_attached} //= 0;
        $volhash->{$volid}->{is_attached} = 1
-           if !$volhash->{$volid}->{is_unused} && !defined($snapname) && !defined($pending);
+           if !$volhash->{$volid}->{is_unused} && !defined($snapname) && !$pending;
 
        $volhash->{$volid}->{referenced_in_snapshot}->{$snapname} = 1
            if defined($snapname);
 
-       $volhash->{$volid}->{referenced_in_pending} = 1 if defined($pending);
+       $volhash->{$volid}->{referenced_in_pending} = 1 if $pending;
 
        my $size = $drive->{size};
        $volhash->{$volid}->{size} //= $size if $size;