Signed-off-by: Wolfgang Bumiller <w.bumil...@proxmox.com> --- src/PVE/LXC.pm | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm index 1225c8b..eb4313d 100644 --- a/src/PVE/LXC.pm +++ b/src/PVE/LXC.pm @@ -11,7 +11,7 @@ use File::Path; use File::Spec; use Cwd qw(); use Fcntl qw(O_RDONLY O_NOFOLLOW O_DIRECTORY); -use Errno qw(ELOOP ENOTDIR EROFS ECONNREFUSED ENOSYS); +use Errno qw(ELOOP ENOTDIR EROFS ECONNREFUSED ENOSYS EEXIST); use IO::Socket::UNIX; use PVE::Exception qw(raise_perm_exc); @@ -1628,6 +1628,33 @@ sub __mountpoint_mount { die "unsupported storage"; } +# Create a directory in the mountpoint staging tempfs. +sub get_staging_mount_path($) { + my ($opt) = @_; + + my $target = get_staging_tempfs() . "/$opt"; + if (!mkdir($target) && $! != EEXIST) { + die "failed to create directory $target: $!\n"; + } + + return $target; +} + +# Mount /run/pve/mountpoints as tmpfs +sub get_staging_tempfs() { + my $target = '/run/pve/mountpoints'; + mkdir("/run/pve"); + if (!mkdir($target)) { + return $target if $! == EEXIST; + die "failed to create directory $target: $!\n"; + } + + PVE::Tools::mount("none", $target, 'tmpfs', 0, "size=8k,mode=755") + or die "failed to mount $target as tmpfs: $!\n"; + + return $target; +} + sub mkfs { my ($dev, $rootuid, $rootgid) = @_; -- 2.20.1 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel