my $path = $rpcenv->check_volume_access($authuser, $storecfg, $vmid, $volid);
PVE::Storage::activate_volumes($storecfg, [ $volid ])
if PVE::Storage::parse_volume_id ($volid, 1);
- die "image '$path' does not exists\n" if (!(-f $path || -b $path));
+
+ my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid);
+ my $dl = PVE::Storage::vdisk_list($storecfg, $storeid, undef);
+ my $foundvolid = undef;
+
+ PVE::Storage::foreach_volid($dl, sub {
+ my ($volumeid) = @_;
+ if($volumeid eq $volid) {
+ $foundvolid = 1;
+ return;
+ }
+ });
+
+ die "image '$path' does not exists\n" if (!(-f $path || -b $path || $foundvolid));
$res->{$ds} = $settings->{$ds};
}
});
if (defined($pool)) {
$rpcenv->check_pool_exist($pool);
- $rpcenv->check_perm_modify($authuser, "/pool/$pool");
}
$rpcenv->check($authuser, "/storage/$storage", ['Datastore.AllocateSpace'])
if (&$vm_is_volid_owner($storecfg, $vmid, $volid)) {
if ($force || $key =~ m/^unused/) {
eval { PVE::Storage::vdisk_free($storecfg, $volid); };
- warn $@ if $@;
+ die $@ if $@;
} else {
PVE::QemuServer::add_unused_volume($conf, $volid, $vmid);
}