All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 2202163e authored by Mike Hibler's avatar Mike Hibler

Sort out ZFS refquota/quota settings, part 2.

Add setzfsquotas script to handle fixup of existing quotas, add update
script to do a one-time invocation of this script at boss-install time,
and fix accountsetup so it will properly set both quotas going forward.
parent 2c6695d9
#!/usr/bin/perl -w
#
# Copyright (c) 2010-2016 University of Utah and the Flux Group.
# Copyright (c) 2010-2017 University of Utah and the Flux Group.
#
# {{{GENIPUBLIC-LICENSE
#
......@@ -75,6 +75,9 @@ my $ZFS_ROOT = "@ZFS_ROOT@";
my $ZFS_QUOTA_USER = "@ZFS_QUOTA_USER@";
my $ZFS_QUOTA_PROJECT = "@ZFS_QUOTA_PROJECT@";
my $ZFS_QUOTA_GROUP = "@ZFS_QUOTA_GROUP@";
my $ZFS_QUOTA_USER_X = "@ZFS_QUOTA_USER_X@";
my $ZFS_QUOTA_PROJECT_X = "@ZFS_QUOTA_PROJECT_X@";
my $ZFS_QUOTA_GROUP_X = "@ZFS_QUOTA_GROUP_X@";
my $PW = "/usr/sbin/pw";
my $USERADD = "/usr/sbin/pw useradd";
my $USERDEL = "/usr/sbin/pw userdel";
......@@ -832,12 +835,22 @@ sub MakeDir($$)
$path = "${ZFS_ROOT}${fs}/$dir";
# XXX quotas
my ($refquota,$mult);
if ($fs eq $USERROOT) {
$cmdarg = "-o quota=$ZFS_QUOTA_USER";
$refquota = $ZFS_QUOTA_USER;
$mult = $ZFS_QUOTA_USER_X;
} elsif ($fs eq $PROJROOT) {
$cmdarg = "-o quota=$ZFS_QUOTA_PROJECT";
$refquota = $ZFS_QUOTA_PROJECT;
$mult = $ZFS_QUOTA_PROJECT_X;
} elsif ($fs eq $GROUPROOT) {
$cmdarg = "-o quota=$ZFS_QUOTA_GROUP";
$refquota = $ZFS_QUOTA_GROUP;
$mult = $ZFS_QUOTA_GROUP_X;
}
if (defined($refquota) && $refquota =~ /^(\d+(?:\.\d+)?)([MGT]?)$/) {
my ($num,$unit) = ($1,$2);
$unit = "" if (!defined($unit));
$num = sprintf "%.1f", $num * $mult;
$cmdarg = "-o refquota=$refquota -o quota=$num$unit";
} else {
$cmdarg = "";
}
......
#
# Fix up ZFS quota settings. We should be using 'refquota' for the amount
# that users can access, and 'quota' to allow additional room for snapshots
# This (refquota non-zero and less than quota) only matters on the mothership
# right now where we are doing ZFS snapshots for backups, but may matter on
# other sites later.
#
use strict;
use libinstall;
use installvars;
sub InstallUpdate($$)
{
my ($version, $phase) = @_;
#
# If something should run in the pre-install phase.
#
if ($phase eq "pre") {
;
}
#
# If something should run in the post-install phase.
#
if ($phase eq "post") {
Phase "zfs-quotas", "Fixing ZFS quotas", sub {
my $cmd = "$SSH -o 'BatchMode=yes' root\@${USERNODE} ".
"$TBROOT/sbin/setzfsquotas -a";
ExecQuietFatal($cmd);
};
}
return 0;
}
1;
# Local Variables:
# mode:perl
# End:
......@@ -70,7 +70,8 @@ LIBEXEC_SCRIPTS = spewleds webcopy spewsource webcvsweb xlogin webviewvc \
$(WEB_BIN_SCRIPTS) $(WEB_SBIN_SCRIPTS)
CTRLSBIN_SCRIPTS= opsdb_control.proxy daemon_wrapper ec2import.proxy \
ec2import-image.pl GrubConf.rb export-template-remote.rb
ec2import-image.pl GrubConf.rb export-template-remote.rb \
setzfsquotas
SBSBIN_SCRIPTS= daemon_wrapper subboss_cacheclean
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment