mirror of
https://git.proxmox.com/git/pve-guest-common
synced 2025-08-06 17:19:20 +00:00
Add foreach_unused_volume
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
4e6382ab58
commit
8db0144048
@ -419,6 +419,19 @@ sub add_unused_volume {
|
||||
return $key;
|
||||
}
|
||||
|
||||
# Iterate over all unused volumes, calling $func for each key/value pair
|
||||
# with additional parameters @param.
|
||||
sub foreach_unused_volume {
|
||||
my ($class, $conf, $func, @param) = @_;
|
||||
|
||||
foreach my $key (keys %{$conf}) {
|
||||
if ($key =~ m/^unused\d+$/) {
|
||||
my $volume = $class->parse_volume($key, $conf->{$key});
|
||||
$func->($key, $volume, @param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Returns whether the template parameter is set in $conf.
|
||||
sub is_template {
|
||||
my ($class, $conf) = @_;
|
||||
|
Loading…
Reference in New Issue
Block a user