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