]> git.proxmox.com Git - qemu-server.git/blobdiff - PVE/API2/Qemu.pm
fix bug #121: activate volumes correctly
[qemu-server.git] / PVE / API2 / Qemu.pm
index 3619cef3563252d82625ffdacb49552d4394d9b6..9537a3cb7f424bda1d14c700efbc1d07bb4ce890 100644 (file)
@@ -53,8 +53,7 @@ my $check_storage_access = sub {
            die "no storage ID specified (and no default storage)\n" if !$storeid;
            $rpcenv->check($authuser, "/storage/$storeid", ['Datastore.AllocateSpace']);
        } else {
-           my $path = $rpcenv->check_volume_access($authuser, $storecfg, $vmid, $volid);
-           die "image '$path' does not exists\n" if (!(-f $path || -b $path));
+           $rpcenv->check_volume_access($authuser, $storecfg, $vmid, $volid);
        }
     });
 };
@@ -87,6 +86,7 @@ my $create_disks = sub {
            $res->{$ds} = PVE::QemuServer::print_drive($vmid, $disk);
        } else {
            my $path = $rpcenv->check_volume_access($authuser, $storecfg, $vmid, $volid);
+           PVE::Storage::activate_volumes($storecfg, [ $volid ]);
            die "image '$path' does not exists\n" if (!(-f $path || -b $path));
            $res->{$ds} = $settings->{$ds};
        }
@@ -301,6 +301,7 @@ __PACKAGE__->register_method({
                    && $rpcenv->{type} ne 'cli';
            } else {
                my $path = $rpcenv->check_volume_access($authuser, $storecfg, $vmid, $archive);
+               PVE::Storage::activate_volumes($storecfg, [ $archive ]);
                die "can't find archive file '$archive'\n" if !($path && -f $path);
                $archive = $path;
            }