Commit d7a1672f authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Add Mike's NFS/LOOPBACK mount changes.

parent bdd19cd7
......@@ -19,7 +19,7 @@ use Exporter;
doaccounts dorpms dotarballs dostartupcmd install_deltas
bootsetup nodeupdate startcmdstatus whatsmynickname
TBBackGround TBForkCmd vnodesetup dorouterconfig
jailsetup dojailconfig JailedNFSMounts findiface
jailsetup dojailconfig JailedMounts findiface
tmccdie tmcctimeout libsetup_getvnodeid dotrafficconfig
OPENTMCC CLOSETMCC RUNTMCC MFS REMOTE JAILED
......@@ -503,8 +503,9 @@ sub domounts()
}
print STDOUT " Mounting $remote on $local\n";
if (system("$MOUNT $remote $local")) {
warn "*** WARNING: Could not $MOUNT $remote on $local: $!\n";
if (system("$NFSMOUNT $remote $local")) {
warn "*** WARNING: Could not $NFSMOUNT ".
"$remote on $local: $!\n";
next;
}
}
......@@ -535,8 +536,8 @@ sub domounts()
}
print STDOUT " Mounting $remote on $local\n";
if (system("$MOUNT $remote $local")) {
warn "*** WARNING: Could not $MOUNT $remote on $local: $!\n";
if (system("$NFSMOUNT $remote $local")) {
warn "*** WARNING: Could not $NFSMOUNT $remote on $local: $!\n";
next;
}
......@@ -670,15 +671,15 @@ sub domounts()
}
#
# Aux function called from the mkjail code to do the NFS mounts outside
# of a jail, and return the list of mounts that were created. This
# will hopefully go away some point with better SFS support inside of
# jails. Local only, of course.
# Aux function called from the mkjail code to do mounts outside
# of a jail, and return the list of mounts that were created. Can use
# either NFS or local loopback. Maybe SFS someday. Local only, of course.
#
sub JailedNFSMounts($$)
sub JailedMounts($$$)
{
my ($vid, $rootpath) = @_;
my ($vid, $rootpath, $usenfs) = @_;
my @mountlist = ();
my $mountstr;
#
# No NFS mounts on remote nodes.
......@@ -687,6 +688,12 @@ sub JailedNFSMounts($$)
return ();
}
if ($usenfs) {
$mountstr = $NFSMOUNT;
} else {
$mountstr = $LOOPBACKMOUNT;
}
#
# Mount same set of existing mounts. A hack, but this whole NFS thing
# is a serious hack inside jails.
......@@ -694,7 +701,7 @@ sub JailedNFSMounts($$)
dbmopen(%MDB, TMMOUNTDB, 0444);
while (my ($remote, $path) = each %MDB) {
$local = "$rootpath/$path";
$local = "$rootpath$path";
if (! -e $local) {
if (! os_mkdir($local, "0770")) {
......@@ -703,9 +710,13 @@ sub JailedNFSMounts($$)
}
}
if (! $usenfs) {
$remote = $path;
}
print STDOUT " Mounting $remote on $local\n";
if (system("$MOUNT $remote $local")) {
warn "*** WARNING: Could not $MOUNT $remote on $local: $!\n";
if (system("$mountstr $remote $local")) {
warn "*** WARNING: Could not $mountstr $remote on $local: $!\n";
next;
}
push(@mountlist, $path);
......@@ -1088,7 +1099,6 @@ sub dohostnames ()
my $hostline = os_etchosts_line($name, $ip, $aliases);
print STDOUT " $hostline\n";
print HOSTS "$hostline\n";
}
else {
......
......@@ -13,7 +13,7 @@ package liblocsetup;
use Exporter;
@ISA = "Exporter";
@EXPORT =
qw ( $CP $EGREP $MOUNT $UMOUNT $TMPASSWD $SFSSD $SFSCD
qw ( $CP $EGREP $NFSMOUNT $LOOPBACKMOUNT $UMOUNT $TMPASSWD $SFSSD $SFSCD
os_cleanup_node os_ifconfig_line os_etchosts_line
os_setup os_groupadd os_useradd os_userdel os_usermod os_mkdir
os_rpminstall_line os_ifconfig_veth
......@@ -50,7 +50,8 @@ sub JAILED() { return libsetup::JAILED(); }
#
$CP = "/bin/cp";
$EGREP = "/usr/bin/egrep -s -q";
$MOUNT = "/sbin/mount -o -b ";
$NFSMOUNT = "/sbin/mount -o -b ";
$LOOPBACKMOUNT = "/sbin/mount -t null ";
$UMOUNT = "/sbin/umount";
$TMPASSWD = "$ETCDIR/master.passwd";
$SFSSD = "/usr/local/sbin/sfssd";
......@@ -202,7 +203,7 @@ sub os_ifconfig_veth($$$$$;$)
}
$uplines = "";
if (defined($iface)) {
$uplines .= "$IFCONFIGBIN $iface up\n";
$uplines .= "$IFCONFIGBIN $iface up $IFC_100MBS $IFC_FDUPLEX\n";
}
$uplines .= "$IFCONFIGBIN veth${id} create\n" .
"$IFCONFIGBIN veth${id} vethaddr $vmac/$vtag" .
......
......@@ -19,7 +19,7 @@ use Exporter;
doaccounts dorpms dotarballs dostartupcmd install_deltas
bootsetup nodeupdate startcmdstatus whatsmynickname
TBBackGround TBForkCmd vnodesetup dorouterconfig
jailsetup dojailconfig JailedNFSMounts findiface
jailsetup dojailconfig JailedMounts findiface
tmccdie tmcctimeout libsetup_getvnodeid dotrafficconfig
OPENTMCC CLOSETMCC RUNTMCC MFS REMOTE JAILED
......@@ -503,8 +503,9 @@ sub domounts()
}
print STDOUT " Mounting $remote on $local\n";
if (system("$MOUNT $remote $local")) {
warn "*** WARNING: Could not $MOUNT $remote on $local: $!\n";
if (system("$NFSMOUNT $remote $local")) {
warn "*** WARNING: Could not $NFSMOUNT ".
"$remote on $local: $!\n";
next;
}
}
......@@ -535,8 +536,8 @@ sub domounts()
}
print STDOUT " Mounting $remote on $local\n";
if (system("$MOUNT $remote $local")) {
warn "*** WARNING: Could not $MOUNT $remote on $local: $!\n";
if (system("$NFSMOUNT $remote $local")) {
warn "*** WARNING: Could not $NFSMOUNT $remote on $local: $!\n";
next;
}
......@@ -670,15 +671,15 @@ sub domounts()
}
#
# Aux function called from the mkjail code to do the NFS mounts outside
# of a jail, and return the list of mounts that were created. This
# will hopefully go away some point with better SFS support inside of
# jails. Local only, of course.
# Aux function called from the mkjail code to do mounts outside
# of a jail, and return the list of mounts that were created. Can use
# either NFS or local loopback. Maybe SFS someday. Local only, of course.
#
sub JailedNFSMounts($$)
sub JailedMounts($$$)
{
my ($vid, $rootpath) = @_;
my ($vid, $rootpath, $usenfs) = @_;
my @mountlist = ();
my $mountstr;
#
# No NFS mounts on remote nodes.
......@@ -687,6 +688,12 @@ sub JailedNFSMounts($$)
return ();
}
if ($usenfs) {
$mountstr = $NFSMOUNT;
} else {
$mountstr = $LOOPBACKMOUNT;
}
#
# Mount same set of existing mounts. A hack, but this whole NFS thing
# is a serious hack inside jails.
......@@ -694,7 +701,7 @@ sub JailedNFSMounts($$)
dbmopen(%MDB, TMMOUNTDB, 0444);
while (my ($remote, $path) = each %MDB) {
$local = "$rootpath/$path";
$local = "$rootpath$path";
if (! -e $local) {
if (! os_mkdir($local, "0770")) {
......@@ -703,9 +710,13 @@ sub JailedNFSMounts($$)
}
}
if (! $usenfs) {
$remote = $path;
}
print STDOUT " Mounting $remote on $local\n";
if (system("$MOUNT $remote $local")) {
warn "*** WARNING: Could not $MOUNT $remote on $local: $!\n";
if (system("$mountstr $remote $local")) {
warn "*** WARNING: Could not $mountstr $remote on $local: $!\n";
next;
}
push(@mountlist, $path);
......@@ -1088,7 +1099,6 @@ sub dohostnames ()
my $hostline = os_etchosts_line($name, $ip, $aliases);
print STDOUT " $hostline\n";
print HOSTS "$hostline\n";
}
else {
......
......@@ -12,7 +12,7 @@ package liblocsetup;
use Exporter;
@ISA = "Exporter";
@EXPORT =
qw ( $CP $EGREP $MOUNT $UMOUNT $TMPASSWD $SFSSD $SFSCD
qw ( $CP $EGREP $NFSMOUNT $UMOUNT $TMPASSWD $SFSSD $SFSCD
os_cleanup_node os_ifconfig_line os_etchosts_line
os_setup os_groupadd os_useradd os_userdel os_usermod os_mkdir
os_rpminstall_line os_ifconfig_veth
......@@ -45,7 +45,7 @@ BEGIN
#
$CP = "/bin/cp";
$EGREP = "/bin/egrep -q";
$MOUNT = "/bin/mount";
$NFSMOUNT = "/bin/mount";
$UMOUNT = "/bin/umount";
$TMPASSWD = "$ETCDIR/passwd";
$SFSSD = "/usr/local/sbin/sfssd";
......
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