use PVE::INotify;
use PVE::JSONSchema qw(get_standard_option);
use PVE::Tools qw(
- dir_glob_foreach file_get_contents file_set_contents
- AT_FDCWD O_PATH $IPV4RE $IPV6RE
+ run_command
+ dir_glob_foreach
+ file_get_contents
+ file_set_contents
+ AT_FDCWD
+ O_PATH
+ $IPV4RE
+ $IPV6RE
);
use PVE::CpuSet;
use PVE::Network;
sub mkfs {
my ($dev, $rootuid, $rootgid) = @_;
- PVE::Tools::run_command(['mkfs.ext4', '-O', 'mmp',
+ run_command(['mkfs.ext4', '-O', 'mmp',
'-E', "root_owner=$rootuid:$rootgid",
$dev]);
}
PVE::GuestHelpers::exec_hookscript($conf, $vmid, 'pre-start', 1);
eval {
- PVE::Tools::run_command($cmd);
+ run_command($cmd);
monitor_start($monitor_socket, $vmid) if defined($monitor_socket);
}
}
- eval { PVE::Tools::run_command($cmd, timeout => $shutdown_timeout) };
+ eval { run_command($cmd, timeout => $shutdown_timeout) };
if (my $err = $@) {
warn $@ if $@;
}
# Unshare the mount namespace
die "failed to unshare mount namespace: $!\n"
if !PVE::Tools::unshare(PVE::Tools::CLONE_NEWNS);
- PVE::Tools::run_command(['mount', '--make-rslave', '/']);
+ run_command(['mount', '--make-rslave', '/']);
return $code->();
});
}
$bwlimit //= 0;
- PVE::Tools::run_command(['/usr/bin/rsync', '--stats', '-X', '-A', '--numeric-ids',
- '-aH', '--whole-file', '--sparse', '--one-file-system',
- "--bwlimit=$bwlimit", "$src/", $dest]);
+ run_command([
+ 'rsync',
+ '--stats',
+ '-X',
+ '-A',
+ '--numeric-ids',
+ '-aH',
+ '--whole-file',
+ '--sparse',
+ '--one-file-system',
+ "--bwlimit=$bwlimit",
+ "$src/",
+ $dest
+ ]);
};
my $err = $@;
while ((system {"fuser"} "fuser", "-s", $dest) == 0) {sleep 1};
foreach my $mount (reverse @mounted) {
- eval { PVE::Tools::run_command(['/bin/umount', $mount], errfunc => sub{})};
+ eval { run_command(['/bin/umount', $mount], errfunc => sub{})};
warn "Can't umount $mount\n" if $@;
}
sub get_lxc_version() {
my $version;
- PVE::Tools::run_command([qw(lxc-start --version)], outfunc => sub {
+ run_command([qw(lxc-start --version)], outfunc => sub {
my ($line) = @_;
# We only parse out major & minor version numbers.
if ($line =~ /^(\d+)\.(\d+)(?:\D.*)?$/) {