use strict;
use warnings;
-use POSIX;
use Fcntl;
use File::Copy 'copy';
+use POSIX;
-use PVE::GuestHelpers;
-use PVE::SafeSyslog;
-use PVE::Tools qw(extract_param);
-use PVE::CpuSet;
+use PVE::CLIHandler;
use PVE::Cluster;
+use PVE::CpuSet;
+use PVE::GuestHelpers;
use PVE::INotify;
-use PVE::RPCEnvironment;
use PVE::JSONSchema qw(get_standard_option);
-use PVE::CLIHandler;
-use PVE::API2::LXC;
+use PVE::LXC::CGroup;
+use PVE::RPCEnvironment;
+use PVE::SafeSyslog;
+use PVE::Tools qw(extract_param);
+
use PVE::API2::LXC::Config;
-use PVE::API2::LXC::Status;
use PVE::API2::LXC::Snapshot;
-use PVE::LXC::CGroup;
+use PVE::API2::LXC::Status;
+use PVE::API2::LXC;
use base qw(PVE::CLIHandler);
my $upid_exit = sub {
my $upid = shift;
my $status = PVE::Tools::upid_read_status($upid);
- exit($status eq 'OK' ? 0 : -1);
+ exit(PVE::Tools::upid_status_is_error($status) ? -1 : 0);
};
sub setup_environment {
my $cgroup = PVE::LXC::CGroup->new($vmid);
my ($cpuset, $path);
- if (defined($path = $cgroup->get_path('cpuset'))) {
- $cpuset = eval { PVE::CpuSet->new_from_path($path); };
- } elsif (defined($path = $cgroup->get_path())) {
- $cpuset = eval { PVE::CpuSet->new_from_path($path); };
+ if (defined($path = $cgroup->get_path('cpuset', 1))) {
+ $cpuset = eval { PVE::CpuSet->new_from_path($path, 1); };
+ } elsif (defined($path = $cgroup->get_path(undef, 1))) {
+ $cpuset = eval { PVE::CpuSet->new_from_path($path, 1); };
} else {
# Container not running.
next;
$path = $mp->{mp};
return if $param->{'ignore-mountpoints'} && $name =~ /^mp\d+/;
my $cmd = ["fstrim", "-v", "$rootdir$path"];
- PVE::Tools::run_command($cmd);
+ PVE::Tools::run_command($cmd, noerr => 1);
});
};
warn $@ if $@;
clone => [ "PVE::API2::LXC", 'clone_vm', ['vmid', 'newid'], { node => $nodename }, $upid_exit ],
migrate => [ "PVE::API2::LXC", 'migrate_vm', ['vmid', 'target'], { node => $nodename }, $upid_exit],
- move_volume => [ "PVE::API2::LXC", 'move_volume', ['vmid', 'volume', 'storage'], { node => $nodename }, $upid_exit ],
+ 'move-volume' => [ "PVE::API2::LXC", 'move_volume', ['vmid', 'volume', 'storage', 'target-vmid', 'target-volume'], { node => $nodename }, $upid_exit ],
+ move_volume => { alias => 'move-volume' },
snapshot => [ "PVE::API2::LXC::Snapshot", 'snapshot', ['vmid', 'snapname'], { node => $nodename } , $upid_exit ],
delsnapshot => [ "PVE::API2::LXC::Snapshot", 'delsnapshot', ['vmid', 'snapname'], { node => $nodename } , $upid_exit ],
fstrim => [ __PACKAGE__, 'fstrim', ['vmid']],
};
-
1;