]> git.proxmox.com Git - pve-container.git/blobdiff - src/PVE/LXC.pm
Add cifs as allowed storage type.
[pve-container.git] / src / PVE / LXC.pm
index bec47ddf8b7f861871b43ac7d2336aa8c8919d0f..4f9674d64221437de690d95f0881478062ba7f19 100644 (file)
@@ -127,6 +127,7 @@ sub vmstatus {
     my $cdtime = gettimeofday;
 
     my $uptime = (PVE::ProcFSTools::read_proc_uptime(1))[0];
+    my $clock_ticks = POSIX::sysconf(&POSIX::_SC_CLK_TCK);
 
     my $unprivileged = {};
 
@@ -189,8 +190,8 @@ sub vmstatus {
 
        next if !$pid; # skip stopped CTs
 
-       my $ctime = (stat("/proc/$pid"))[10]; # 10 = ctime
-       $d->{uptime} = time - $ctime; # the method lxcfs uses
+       my $proc_pid_stat = PVE::ProcFSTools::read_proc_pid_stat($pid);
+       $d->{uptime} = int(($uptime - $proc_pid_stat->{starttime}) / $clock_ticks); # the method lxcfs uses
 
        my $unpriv = $unprivileged->{$vmid};
 
@@ -361,13 +362,15 @@ sub update_lxc_config {
 
     my $ostype = $conf->{ostype} || die "missing 'ostype' - internal error";
 
-    my $inc ="/usr/share/lxc/config/$ostype.common.conf";
-    $inc ="/usr/share/lxc/config/common.conf" if !-f $inc;
+    my $cfgpath = '/usr/share/lxc/config';
+    my $inc = "$cfgpath/$ostype.common.conf";
+    $inc ="$cfgpath/common.conf" if !-f $inc;
     $raw .= "lxc.include = $inc\n";
     if ($unprivileged || $custom_idmap) {
-       $inc = "/usr/share/lxc/config/$ostype.userns.conf";
-       $inc = "/usr/share/lxc/config/userns.conf" if !-f $inc;
-       $raw .= "lxc.include = $inc\n"
+       $inc = "$cfgpath/$ostype.userns.conf";
+       $inc = "$cfgpath/userns.conf" if !-f $inc;
+       $raw .= "lxc.include = $inc\n";
+       $raw .= "lxc.seccomp.profile = $cfgpath/pve-userns.seccomp\n";
     }
 
     # WARNING: DO NOT REMOVE this without making sure that loop device nodes
@@ -1345,7 +1348,7 @@ sub alloc_disk {
 
     eval {
        my $do_format = 0;
-       if ($scfg->{type} eq 'dir' || $scfg->{type} eq 'nfs') {
+       if ($scfg->{type} eq 'dir' || $scfg->{type} eq 'nfs' || $scfg->{type} eq 'cifs' ) {
            if ($size_kb > 0) {
                $volid = PVE::Storage::vdisk_alloc($storecfg, $storage, $vmid, 'raw',
                                                   undef, $size_kb);
@@ -1557,7 +1560,7 @@ sub vm_start {
     eval { PVE::Tools::run_command($cmd); };
     if (my $err = $@) {
        unlink $skiplock_flag_fn;
-       die $err if $err;
+       die $err;
     }
 
     return;
@@ -1676,6 +1679,8 @@ sub copy_volume {
     # (not-mounted) directory.
     my $new_volid;
     eval {
+       # Make sure $mp contains a correct size.
+       $mp->{size} = PVE::Storage::volume_size_info($storage_cfg, $mp->{volume});
        my $needs_chown;
        ($new_volid, $needs_chown) = alloc_disk($storage_cfg, $vmid, $storage, $mp->{size}/1024, $rootuid, $rootgid);
        if ($needs_chown) {