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);
}
});
};
$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 ])
+ if PVE::Storage::parse_volume_id ($volid, 1);
die "image '$path' does not exists\n" if (!(-f $path || -b $path));
$res->{$ds} = $settings->{$ds};
}
if ($archive eq '-') {
die "pipe requires cli environment\n"
- && $rpcenv->{type} ne 'cli';
+ if $rpcenv->{type} ne 'cli';
} else {
my $path = $rpcenv->check_volume_access($authuser, $storecfg, $vmid, $archive);
+
+ PVE::Storage::activate_volumes($storecfg, [ $archive ])
+ if PVE::Storage::parse_volume_id ($archive, 1);
+
die "can't find archive file '$archive'\n" if !($path && -f $path);
$archive = $path;
}
my $delVMfromPoolFn = sub {
my $usercfg = cfs_read_file("user.cfg");
- my $pool = $usercfg->{vms}->{$vmid};
- if (my $data = $usercfg->{pools}->{$pool}) {
- delete $data->{vms}->{$vmid};
- delete $usercfg->{vms}->{$vmid};
- cfs_write_file("user.cfg", $usercfg);
+ if (my $pool = $usercfg->{vms}->{$vmid}) {
+ if (my $data = $usercfg->{pools}->{$pool}) {
+ delete $data->{vms}->{$vmid};
+ delete $usercfg->{vms}->{$vmid};
+ cfs_write_file("user.cfg", $usercfg);
+ }
}
};
my $storecfg = PVE::Storage::config();
- if (&$vm_is_ha_managed($vmid)) {
+ if (&$vm_is_ha_managed($vmid) && !$stateuri &&
+ $rpcenv->{type} ne 'ha') {
my $hacmd = sub {
my $upid = shift;
my $storecfg = PVE::Storage::config();
- if (&$vm_is_ha_managed($vmid)) {
+ if (&$vm_is_ha_managed($vmid) && $rpcenv->{type} ne 'ha') {
my $hacmd = sub {
my $upid = shift;
if !$param->{online};
}
- if (&$vm_is_ha_managed($vmid)) {
+ my $storecfg = PVE::Storage::config();
+ PVE::QemuServer::check_storage_availability($storecfg, $conf, $target);
+
+ if (&$vm_is_ha_managed($vmid) && $rpcenv->{type} ne 'ha') {
my $hacmd = sub {
my $upid = shift;