]>
git.proxmox.com Git - pve-container.git/blob - src/PVE/CLI/pct.pm
10 use PVE
::GuestHelpers
;
12 use PVE
::Tools
qw(extract_param);
16 use PVE
::RPCEnvironment
;
17 use PVE
::JSONSchema
qw(get_standard_option);
20 use PVE
::API2
::LXC
::Config
;
21 use PVE
::API2
::LXC
::Status
;
22 use PVE
::API2
::LXC
::Snapshot
;
25 use base
qw(PVE::CLIHandler);
27 my $nodename = PVE
::INotify
::nodename
();
31 my $status = PVE
::Tools
::upid_read_status
($upid);
32 exit($status eq 'OK' ?
0 : -1);
35 sub setup_environment
{
36 PVE
::RPCEnvironment-
>setup_default_cli_env();
39 __PACKAGE__-
>register_method ({
43 description
=> "Show CT status.",
45 additionalProperties
=> 0,
47 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::LXC
::complete_ctid
}),
49 description
=> "Verbose output format",
55 returns
=> { type
=> 'null'},
60 my $conf = PVE
::LXC
::Config-
>load_config ($param->{vmid
});
62 my $vmstatus = PVE
::LXC
::vmstatus
($param->{vmid
});
63 my $stat = $vmstatus->{$param->{vmid
}};
64 if ($param->{verbose
}) {
65 foreach my $k (sort (keys %$stat)) {
71 my $status = $stat->{status
} || 'unknown';
72 print "status: $status\n";
83 PVE
::CLIHandler
::get_standard_mapping
('pve-password'),
88 return $mapping->{$name};
91 __PACKAGE__-
>register_method ({
95 description
=> "Unlock the VM.",
97 additionalProperties
=> 0,
99 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::LXC
::complete_ctid
}),
102 returns
=> { type
=> 'null'},
106 my $vmid = $param->{vmid
};
108 PVE
::LXC
::Config-
>remove_lock($vmid);
113 __PACKAGE__-
>register_method ({
117 description
=> "Launch a console for the specified container.",
119 additionalProperties
=> 0,
121 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::LXC
::complete_ctid_running
}),
123 description
=> "Escape sequence prefix. For example to use <Ctrl+b q> as the escape sequence pass '^b'.",
126 pattern
=> '\^?[a-z]',
131 returns
=> { type
=> 'null' },
136 # test if container exists on this node
137 my $conf = PVE
::LXC
::Config-
>load_config($param->{vmid
});
139 my $cmd = PVE
::LXC
::get_console_command
($param->{vmid
}, $conf, $param->{escape
});
143 __PACKAGE__-
>register_method ({
147 description
=> "Launch a shell for the specified container.",
149 additionalProperties
=> 0,
151 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::LXC
::complete_ctid_running
}),
154 returns
=> { type
=> 'null' },
159 my $vmid = $param->{vmid
};
161 # test if container exists on this node
162 PVE
::LXC
::Config-
>load_config($vmid);
164 die "Error: container '$vmid' not running!\n" if !PVE
::LXC
::check_running
($vmid);
166 exec('lxc-attach', '-n', $vmid);
169 __PACKAGE__-
>register_method ({
173 description
=> "Launch a command inside the specified container.",
175 additionalProperties
=> 0,
177 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::LXC
::complete_ctid_running
}),
178 'extra-args' => get_standard_option
('extra-args'),
181 returns
=> { type
=> 'null' },
186 # test if container exists on this node
187 PVE
::LXC
::Config-
>load_config($param->{vmid
});
189 if (!@{$param->{'extra-args'}}) {
190 die "missing command";
192 exec('lxc-attach', '-n', $param->{vmid
}, '--', @{$param->{'extra-args'}});
195 __PACKAGE__-
>register_method ({
199 description
=> "Run a filesystem check (fsck) on a container volume.",
201 additionalProperties
=> 0,
203 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::LXC
::complete_ctid_stopped
}),
207 description
=> "Force checking, even if the filesystem seems clean",
213 description
=> "A volume on which to run the filesystem check",
214 enum
=> [PVE
::LXC
::Config-
>valid_volume_keys()],
218 returns
=> { type
=> 'null' },
222 my $vmid = $param->{'vmid'};
223 my $device = defined($param->{'device'}) ?
$param->{'device'} : 'rootfs';
225 my $command = ['fsck', '-a', '-l'];
226 push(@$command, '-f') if $param->{force
};
228 # critical path: all of this will be done while the container is locked
231 my $conf = PVE
::LXC
::Config-
>load_config($vmid);
232 my $storage_cfg = PVE
::Storage
::config
();
234 defined($conf->{$device}) || die "cannot run command on non-existing mount point $device\n";
236 my $mount_point = $device eq 'rootfs' ? PVE
::LXC
::Config-
>parse_ct_rootfs($conf->{$device}) :
237 PVE
::LXC
::Config-
>parse_ct_mountpoint($conf->{$device});
239 die "cannot run fsck when container is running\n"
240 if PVE
::LXC
::check_running
($vmid);
242 my $volid = $mount_point->{volume
};
245 my $storage_id = PVE
::Storage
::parse_volume_id
($volid, 1);
248 my (undef, undef, undef, undef, undef, undef, $format) =
249 PVE
::Storage
::parse_volname
($storage_cfg, $volid);
251 die "unable to run fsck for '$volid' (format == $format)\n"
254 $path = PVE
::Storage
::map_volume
($storage_cfg, $volid);
257 if (($volid =~ m
|^/.+|) && (-b
$volid)) {
258 # pass block devices directly
261 die "path '$volid' does not point to a block device\n";
265 push(@$command, $path);
266 PVE
::Tools
::run_command
($command);
268 PVE
::Storage
::unmap_volume
($storage_cfg, $volid) if $storage_id;
271 PVE
::LXC
::Config-
>lock_config($vmid, $do_fsck);
275 __PACKAGE__-
>register_method({
279 description
=> "Mount the container's filesystem on the host. " .
280 "This will hold a lock on the container and is meant for emergency maintenance only " .
281 "as it will prevent further operations on the container other than start and stop.",
283 additionalProperties
=> 0,
285 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::LXC
::complete_ctid
}),
288 returns
=> { type
=> 'null' },
292 my $rpcenv = PVE
::RPCEnvironment
::get
();
294 my $vmid = extract_param
($param, 'vmid');
295 my $storecfg = PVE
::Storage
::config
();
296 PVE
::LXC
::Config-
>lock_config($vmid, sub {
297 my $conf = PVE
::LXC
::Config-
>set_lock($vmid, 'mounted');
298 PVE
::LXC
::mount_all
($vmid, $storecfg, $conf);
301 print "mounted CT $vmid in '/var/lib/lxc/$vmid/rootfs'\n";
305 __PACKAGE__-
>register_method({
309 description
=> "Unmount the container's filesystem.",
311 additionalProperties
=> 0,
313 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::LXC
::complete_ctid
}),
316 returns
=> { type
=> 'null' },
320 my $rpcenv = PVE
::RPCEnvironment
::get
();
322 my $vmid = extract_param
($param, 'vmid');
323 my $storecfg = PVE
::Storage
::config
();
324 PVE
::LXC
::Config-
>lock_config($vmid, sub {
325 my $conf = PVE
::LXC
::Config-
>load_config($vmid);
326 PVE
::LXC
::umount_all
($vmid, $storecfg, $conf, 0);
327 PVE
::LXC
::Config-
>remove_lock($vmid, 'mounted');
332 __PACKAGE__-
>register_method({
336 description
=> "Get the container's current disk usage.",
338 additionalProperties
=> 0,
340 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::LXC
::complete_ctid
}),
343 returns
=> { type
=> 'null' },
347 my $rpcenv = PVE
::RPCEnvironment
::get
();
349 # JSONSchema's format_size is exact, this uses floating point numbers
352 return $size if $size < 1024.;
354 return sprintf('%.1fK', ${size
}) if $size < 1024.;
356 return sprintf('%.1fM', ${size
}) if $size < 1024.;
358 return sprintf('%.1fG', ${size
}) if $size < 1024.;
360 return sprintf('%.1fT', ${size
}) if $size < 1024.;
363 my $vmid = extract_param
($param, 'vmid');
364 PVE
::LXC
::Config-
>lock_config($vmid, sub {
365 my $pid = eval { PVE
::LXC
::find_lxc_pid
($vmid) };
366 my ($conf, $rootdir, $storecfg, $mounted);
368 $conf = PVE
::LXC
::Config-
>set_lock($vmid, 'mounted');
369 $rootdir = "/var/lib/lxc/$vmid/rootfs";
370 $storecfg = PVE
::Storage
::config
();
371 PVE
::LXC
::mount_all
($vmid, $storecfg, $conf);
374 $conf = PVE
::LXC
::Config-
>load_config($vmid);
375 $rootdir = "/proc/$pid/root";
378 my @list = [qw(MP Volume Size Used Avail Use% Path)];
379 my @len = map { length($_) } @{$list[0]};
382 PVE
::LXC
::Config-
>foreach_volume($conf, sub {
383 my ($name, $mp) = @_;
384 my $path = $mp->{mp
};
386 my $df = PVE
::Tools
::df
("$rootdir/$path", 3);
387 my $total = $format->($df->{total
});
388 my $used = $format->($df->{used
});
389 my $avail = $format->($df->{avail
});
391 my $pc = sprintf('%.1f', $df->{used
}/$df->{total
});
393 my $entry = [ $name, $mp->{volume
}, $total, $used, $avail, $pc, $path ];
396 foreach my $i (0..5) {
397 $len[$i] = length($entry->[$i])
398 if $len[$i] < length($entry->[$i]);
402 my $format = "%-$len[0]s %-$len[1]s %$len[2]s %$len[3]s %$len[4]s %$len[5]s %s\n";
403 printf($format, @$_) foreach @list;
408 PVE
::LXC
::umount_all
($vmid, $storecfg, $conf, 0);
409 PVE
::LXC
::Config-
>remove_lock($vmid, 'mounted');
415 # File creation with specified ownership and permissions.
416 # User and group can be names or decimal numbers.
417 # Permissions are explicit (not affected by umask) and can be numeric with the
418 # usual 0/0x prefixes for octal/hex.
420 my ($path, $perms, $user, $group) = @_;
422 if (defined($user)) {
423 if ($user =~ /^\d+$/) {
426 $uid = getpwnam($user) or die "failed to get uid for: $user\n"
429 if (defined($group)) {
430 if ($group =~ /^\d+$/) {
433 $gid = getgrnam($group) or die "failed to get gid for: $group\n"
437 if (defined($perms)) {
439 my ($mode, $unparsed) = POSIX
::strtoul
($perms, 0);
440 die "invalid mode: '$perms'\n" if $perms eq '' || $unparsed > 0 || $!;
445 if (sysopen($fd, $path, O_WRONLY
| O_CREAT
| O_EXCL
, 0)) {
446 $perms = 0666 & ~umask if !defined($perms);
448 # If the path previously existed then we do not care about left-over
449 # file descriptors even if the permissions/ownership is changed.
450 sysopen($fd, $path, O_WRONLY
| O_CREAT
| O_TRUNC
)
451 or die "failed to create file: $path: $!\n";
456 if (defined($perms)) {
461 if (defined($uid) || defined($gid)) {
463 my ($fuid, $fgid) = (stat($fd))[4,5] if !defined($uid) || !defined($gid);
464 $uid = $fuid if !defined($uid);
465 $gid = $fgid if !defined($gid);
466 chown($uid, $gid, $fd)
467 or die "failed to change file owner: $!\n";
472 __PACKAGE__-
>register_method ({
476 description
=> "Rescan all storages and update disk sizes and unused disk images.",
478 additionalProperties
=> 0,
480 vmid
=> get_standard_option
('pve-vmid', {
482 completion
=> \
&PVE
::LXC
::complete_ctid
,
488 description
=> 'Do not actually write changes out to conifg.',
492 returns
=> { type
=> 'null'},
496 my $dryrun = $param->{dryrun
};
498 print "NOTE: running in dry-run mode, won't write changes out!\n" if $dryrun;
500 PVE
::LXC
::rescan
($param->{vmid
}, 0, $dryrun);
505 __PACKAGE__-
>register_method({
509 description
=> "Copy a file from the container to the local system.",
511 additionalProperties
=> 0,
513 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::LXC
::complete_ctid
}),
516 description
=> "Path to a file inside the container to pull.",
520 description
=> "Destination",
524 description
=> 'Owner user name or id.',
529 description
=> 'Owner group name or id.',
534 description
=> "File permissions to use (octal by default, prefix with '0x' for hexadecimal).",
541 description
=> "the task ID.",
546 my $rpcenv = PVE
::RPCEnvironment
::get
();
548 my $vmid = extract_param
($param, 'vmid');
549 my $path = extract_param
($param, 'path');
550 my $dest = extract_param
($param, 'destination');
552 my $perms = extract_param
($param, 'perms');
553 # assume octal as default
554 $perms = "0$perms" if defined($perms) && $perms !~m/^0/;
555 my $user = extract_param
($param, 'user');
556 my $group = extract_param
($param, 'group');
559 my $running = PVE
::LXC
::check_running
($vmid);
560 die "can only pull files from a running VM" if !$running;
563 my $pid = PVE
::LXC
::find_lxc_pid
($vmid);
564 # Avoid symlink issues by opening the files from inside the
565 # corresponding namespaces.
566 my $destfd = create_file
($dest, $perms, $user, $group);
568 sysopen my $mntnsfd, "/proc/$pid/ns/mnt", O_RDONLY
569 or die "failed to open the container's mount namespace\n";
570 PVE
::Tools
::setns
(fileno($mntnsfd), PVE
::Tools
::CLONE_NEWNS
)
571 or die "failed to enter the container's mount namespace\n";
573 chdir('/') or die "failed to change to container root directory\n";
575 open my $srcfd, '<', $path
576 or die "failed to open $path: $!\n";
578 copy
($srcfd, $destfd);
581 # This avoids having to setns() back to our namespace.
582 return $rpcenv->fork_worker('pull_file', $vmid, undef, $realcmd);
585 return PVE
::LXC
::Config-
>lock_config($vmid, $code);
588 __PACKAGE__-
>register_method({
592 description
=> "Copy a local file to the container.",
594 additionalProperties
=> 0,
596 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::LXC
::complete_ctid
}),
599 description
=> "Path to a local file.",
603 description
=> "Destination inside the container to write to.",
607 description
=> 'Owner user name or id. When using a name it must exist inside the container.',
612 description
=> 'Owner group name or id. When using a name it must exist inside the container.',
617 description
=> "File permissions to use (octal by default, prefix with '0x' for hexadecimal).",
624 description
=> "the task ID.",
629 my $rpcenv = PVE
::RPCEnvironment
::get
();
631 my $vmid = extract_param
($param, 'vmid');
632 my $file = extract_param
($param, 'file');
633 my $dest = extract_param
($param, 'destination');
635 my $perms = extract_param
($param, 'perms');
636 # assume octal as default
637 $perms = "0$perms" if defined($perms) && $perms !~m/^0/;
638 my $user = extract_param
($param, 'user');
639 my $group = extract_param
($param, 'group');
642 my $running = PVE
::LXC
::check_running
($vmid);
643 die "can only push files to a running CT\n" if !$running;
645 my $conf = PVE
::LXC
::Config-
>load_config($vmid);
646 my $unprivileged = $conf->{unprivileged
};
649 my $pid = PVE
::LXC
::find_lxc_pid
($vmid);
650 # We open the file then enter the container's mount - and for
651 # unprivileged containers - user namespace and then create the
652 # file. This avoids symlink attacks as a symlink cannot point
653 # outside the namespace and our own access is equivalent to the
654 # container-local's root user. Also the user-passed -user and
655 # -group parameters will use the container-local's user and
657 sysopen my $srcfd, $file, O_RDONLY
658 or die "failed to open $file for reading\n";
660 sysopen my $mntnsfd, "/proc/$pid/ns/mnt", O_RDONLY
661 or die "failed to open the container's mount namespace\n";
664 sysopen $usernsfd, "/proc/$pid/ns/user", O_RDONLY
665 or die "failed to open the container's user namespace\n";
668 PVE
::Tools
::setns
(fileno($mntnsfd), PVE
::Tools
::CLONE_NEWNS
)
669 or die "failed to enter the container's mount namespace\n";
671 chdir('/') or die "failed to change to container root directory\n";
674 PVE
::Tools
::setns
(fileno($usernsfd), PVE
::Tools
::CLONE_NEWUSER
)
675 or die "failed to enter the container's user namespace\n";
677 POSIX
::setgid
(0) or die "setgid failed: $!\n";
678 POSIX
::setuid
(0) or die "setuid failed: $!\n";
681 my $destfd = create_file
($dest, $perms, $user, $group);
682 copy
($srcfd, $destfd);
685 # This avoids having to setns() back to our namespace.
686 return $rpcenv->fork_worker('push_file', $vmid, undef, $realcmd);
689 return PVE
::LXC
::Config-
>lock_config($vmid, $code);
692 __PACKAGE__-
>register_method ({
696 description
=> "Print the list of assigned CPU sets.",
698 additionalProperties
=> 0,
701 returns
=> { type
=> 'null'},
705 my $ctlist = PVE
::LXC
::config_list
();
711 foreach my $vmid (sort keys %$ctlist) {
712 my $cgroup = PVE
::LXC
::CGroup-
>new($vmid);
715 if (defined($path = $cgroup->get_path('cpuset'))) {
716 $cpuset = eval { PVE
::CpuSet-
>new_from_path($path); };
717 } elsif (defined($path = $cgroup->get_path())) {
718 $cpuset = eval { PVE
::CpuSet-
>new_from_path($path); };
720 # Container not running.
728 my @cpuset_members = $cpuset->members();
732 my $last = $cpuset_members[-1];
734 for (my $id = 0; $id <= $last; $id++) {
735 my $empty = ' ' x
length("$id");
736 $line .= ' ' . ($cpuset->has($id) ?
$id : $empty);
738 $len = length($line) if length($line) > $len;
739 $id_len = length($vmid) if length($vmid) > $id_len;
741 $res->{$vmid} = $line;
744 my @vmlist = sort keys %$res;
746 if (scalar(@vmlist)) {
747 my $header = '-' x
($len + $id_len) . "\n";
750 foreach my $vmid (@vmlist) {
751 print sprintf("%${id_len}i%s\n", $vmid, $res->{$vmid});
756 print "no running containers\n";
762 __PACKAGE__-
>register_method ({
766 description
=> "Run fstrim on a chosen CT and its mountpoints.",
768 additionalProperties
=> 0,
770 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::LXC
::complete_ctid
}),
773 returns
=> { type
=> 'null' },
777 my $vmid = $param->{'vmid'};
779 my $rootdir = "/var/lib/lxc/$vmid/rootfs";
781 my $storecfg = PVE
::Storage
::config
();
782 my $conf = PVE
::LXC
::Config-
>set_lock($vmid, 'fstrim');
785 PVE
::LXC
::mount_all
($vmid, $storecfg, $conf);
786 PVE
::LXC
::Config-
>foreach_volume($conf, sub {
787 my ($name, $mp) = @_;
789 my $cmd = ["fstrim", "-v", "$rootdir$path"];
790 PVE
::Tools
::run_command
($cmd);
795 PVE
::LXC
::umount_all
($vmid, $storecfg, $conf, 0);
796 PVE
::LXC
::Config-
>remove_lock($vmid, 'fstrim');
802 list
=> [ 'PVE::API2::LXC', 'vmlist', [], { node
=> $nodename }, sub {
804 return if !scalar(@$res);
805 my $format = "%-10s %-10s %-12s %-20s\n";
806 printf($format, 'VMID', 'Status', 'Lock', 'Name');
807 foreach my $d (sort {$a->{vmid
} <=> $b->{vmid
} } @$res) {
808 printf($format, $d->{vmid
}, $d->{status
}, $d->{lock}, $d->{name
});
811 config
=> [ "PVE::API2::LXC::Config", 'vm_config', ['vmid'],
812 { node
=> $nodename }, sub {
814 foreach my $k (sort (keys %$config)) {
815 next if $k eq 'digest';
817 my $v = $config->{$k};
818 if ($k eq 'description') {
819 $v = PVE
::Tools
::encode_text
($v);
823 if (defined($config->{'lxc'})) {
824 my $lxc_list = $config->{'lxc'};
825 foreach my $lxc_opt (@$lxc_list) {
826 print "$lxc_opt->[0]: $lxc_opt->[1]\n"
831 pending
=> [ "PVE::API2::LXC", "vm_pending", ['vmid'], { node
=> $nodename }, \
&PVE
::GuestHelpers
::format_pending
],
832 set
=> [ 'PVE::API2::LXC::Config', 'update_vm', ['vmid'], { node
=> $nodename }],
834 resize
=> [ "PVE::API2::LXC", 'resize_vm', ['vmid', 'disk', 'size'], { node
=> $nodename } ],
836 create
=> [ 'PVE::API2::LXC', 'create_vm', ['vmid', 'ostemplate'], { node
=> $nodename }, $upid_exit ],
837 restore
=> [ 'PVE::API2::LXC', 'create_vm', ['vmid', 'ostemplate'], { node
=> $nodename, restore
=> 1 }, $upid_exit ],
839 start
=> [ 'PVE::API2::LXC::Status', 'vm_start', ['vmid'], { node
=> $nodename }, $upid_exit],
840 suspend
=> [ 'PVE::API2::LXC::Status', 'vm_suspend', ['vmid'], { node
=> $nodename }, $upid_exit],
841 resume
=> [ 'PVE::API2::LXC::Status', 'vm_resume', ['vmid'], { node
=> $nodename }, $upid_exit],
842 shutdown => [ 'PVE::API2::LXC::Status', 'vm_shutdown', ['vmid'], { node
=> $nodename }, $upid_exit],
843 stop
=> [ 'PVE::API2::LXC::Status', 'vm_stop', ['vmid'], { node
=> $nodename }, $upid_exit],
844 reboot
=> [ 'PVE::API2::LXC::Status', 'vm_reboot', ['vmid'], { node
=> $nodename }, $upid_exit],
846 clone
=> [ "PVE::API2::LXC", 'clone_vm', ['vmid', 'newid'], { node
=> $nodename }, $upid_exit ],
847 migrate
=> [ "PVE::API2::LXC", 'migrate_vm', ['vmid', 'target'], { node
=> $nodename }, $upid_exit],
848 move_volume
=> [ "PVE::API2::LXC", 'move_volume', ['vmid', 'volume', 'storage'], { node
=> $nodename }, $upid_exit ],
850 status
=> [ __PACKAGE__
, 'status', ['vmid']],
851 console
=> [ __PACKAGE__
, 'console', ['vmid']],
852 enter
=> [ __PACKAGE__
, 'enter', ['vmid']],
853 unlock
=> [ __PACKAGE__
, 'unlock', ['vmid']],
854 exec => [ __PACKAGE__
, 'exec', ['vmid', 'extra-args']],
855 fsck
=> [ __PACKAGE__
, 'fsck', ['vmid']],
857 mount
=> [ __PACKAGE__
, 'mount', ['vmid']],
858 unmount
=> [ __PACKAGE__
, 'unmount', ['vmid']],
859 push => [ __PACKAGE__
, 'push', ['vmid', 'file', 'destination']],
860 pull
=> [ __PACKAGE__
, 'pull', ['vmid', 'path', 'destination']],
862 df
=> [ __PACKAGE__
, 'df', ['vmid']],
863 rescan
=> [ __PACKAGE__
, 'rescan', []],
865 destroy
=> [ 'PVE::API2::LXC', 'destroy_vm', ['vmid'],
866 { node
=> $nodename }, $upid_exit ],
868 snapshot
=> [ "PVE::API2::LXC::Snapshot", 'snapshot', ['vmid', 'snapname'],
869 { node
=> $nodename } , $upid_exit ],
871 delsnapshot
=> [ "PVE::API2::LXC::Snapshot", 'delsnapshot', ['vmid', 'snapname'], { node
=> $nodename } , $upid_exit ],
873 listsnapshot
=> [ "PVE::API2::LXC::Snapshot", 'list', ['vmid'], { node
=> $nodename }, \
&PVE
::GuestHelpers
::print_snapshot_tree
],
875 rollback
=> [ "PVE::API2::LXC::Snapshot", 'rollback', ['vmid', 'snapname'], { node
=> $nodename } , $upid_exit ],
877 template
=> [ "PVE::API2::LXC", 'template', ['vmid'], { node
=> $nodename }],
879 cpusets
=> [ __PACKAGE__
, 'cpusets', []],
881 fstrim
=> [ __PACKAGE__
, 'fstrim', ['vmid']],