Commit f9b615e4 authored by Leigh Stoller's avatar Leigh Stoller

Merge branch 'master' into arm64

parents bdde40fe d23bc2d2
......@@ -69,6 +69,7 @@ my $GROUPDEL = "/usr/sbin/pw groupdel";
my $CHPASS = "/usr/bin/chpass";
my $ZFS = "/sbin/zfs";
my $SKEL = "/usr/share/skel";
my $PIDFILE = "/var/run/mountd.pid";
# XXX
my $NOSUCHUSER = 67;
......@@ -176,6 +177,7 @@ sub AddUser()
if ($?) {
fatal("Could not create ZFS $path");
}
system("$ZFS share -a");
}
}
......@@ -261,13 +263,15 @@ sub AddProject()
if ($?) {
fatal("Could not create ZFS $path");
}
system("$ZFS share -a");
}
$path = "${ZFS_ROOT}${GROUPROOT}/$name";
if (!ZFSexists($path)) {
system("$ZFS create -o quota=${ZFS_QUOTA_GROUP} $path");
if ($?) {
fatal("Could not create ZFS $path");
}
}
system("$ZFS share -a");
}
}
......@@ -371,3 +375,28 @@ sub ZFSexists($)
system("$ZFS list $path >/dev/null 2>&1");
return ($? ? 0 : 1);
}
#
# HUP Mountd after changes to ZFS volumes. Not used, Mike says we
# can do "zfs share -a" instead, but I will leave this code here
# for now.
#
sub HUPMountd()
{
if (! -e $PIDFILE) {
fatal("$PIDFILE does not exist. Is mountd running?");
}
my $daemonpid = `cat $PIDFILE`;
chomp($daemonpid);
# untaint
if ($daemonpid =~ /^([-\@\w.]+)$/) {
$daemonpid = $1;
}
if (kill('HUP', $daemonpid) == 0) {
fatal("Could not kill(HUP) process $daemonpid (mountd): $!");
}
# Give mountd time to react.
sleep(1);
}
......@@ -46,6 +46,7 @@ my $CONTROL = "@USERNODE@";
my $TBOPS = "@TBOPSEMAIL@";
my $TBAUDIT = "@TBAUDITEMAIL@";
my $TBBASE = "@TBBASE@";
my $WWWHOST = "@WWWHOST@";
my $PGENISUPPORT = @PROTOGENI_SUPPORT@;
my $DOPROVENANCE = @IMAGEPROVENANCE@;
my $TBWWW = "@TBWWW@";
......@@ -271,6 +272,7 @@ sub DESTROY {
sub LookupByURL($$)
{
my ($class, $url) = @_;
my ($pid,$imagename);
return undef
if (! ($url =~ /^(ftp|http|https):/));
......@@ -281,12 +283,35 @@ sub LookupByURL($$)
DBQueryWarn("select pid,imagename from image_versions ".
"where metadata_url=$safe_url and deleted is null");
return undef
if (!$query_result || !$query_result->numrows);
if (!$query_result);
my ($pid,$imagename) = $query_result->fetchrow_array();
if ($query_result->numrows) {
my ($pid,$imagename) = $query_result->fetchrow_array();
# Want latest version.
return Image->Lookup($pid, $imagename);
}
else {
#
# If the URL points back to ourself, find the image it refers
# to. Later phases will catch misuse of the URL (not allowed,
# does not exist).
#
require URI;
require URI::QueryParam;
my $uri = URI->new($url);
return undef
if (!defined($uri));
return undef
if ($uri->host() ne $WWWHOST);
my $uuid = $uri->query_param("uuid");
return undef
if (!defined($uuid) || $uuid eq "");
# Want latest version.
return Image->Lookup($pid, $imagename);
return Image->Lookup($uuid);
}
return undef;
}
#
......
......@@ -34,4 +34,19 @@
<value>Linux</value>
</attribute>
</osid>
<osid>
<attribute name="OS"><value>FreeBSD</value></attribute>
<attribute name="description"><value>Fake MFS for PCVMs.</value></attribute>
<attribute name="features"><value>isup</value></attribute>
<attribute name="magic"><value></value></attribute>
<attribute name="mfs"><value>1</value></attribute>
<attribute name="mustclean"><value>0</value></attribute>
<attribute name="op_mode"><value>RELOAD-PCVM</value></attribute>
<attribute name="osname"><value>FRISBEE-MFS-PCVM</value></attribute>
<attribute name="path"><value>/tftpboot/frisbee-pcvm</value></attribute>
<attribute name="pid"><value>emulab-ops</value></attribute>
<attribute name="reboot_waittime"><value>120</value></attribute>
<attribute name="shared"><value>1</value></attribute>
<attribute name="version"><value>7.2</value></attribute>
</osid>
</descriptors>
......@@ -344,7 +344,8 @@ if ($OPSDBSUPPORT) {
}
}
if (!$experiment->elabinelab()) {
# Lets not do this anymore.
if (0 && !$experiment->elabinelab()) {
TBDebugTimeStamp("verify-ns started");
if ($NSVERIFY) {
print "Verifying parse ...\n";
......
......@@ -4786,7 +4786,21 @@ COMMAND_PROTOTYPE(domounts)
* XXX Fix this ... crazy routing problems on the racks.
*/
if (reqp->isvnode && reqp->sharing_mode[0]) {
fsnode = FSJAILIP;
/*
* See if the node has a public IP.
*/
res = mydb_query("select IP from virt_node_public_addr "
"where node_id='%s'",
1, reqp->vnodeid);
if (!res) {
error("MOUNTS: %s: DB Error public IP!\n",
reqp->vnodeid);
return 1;
}
if (!mysql_num_rows(res)) {
fsnode = FSJAILIP;
}
mysql_free_result(res);
}
#endif
/*
......
......@@ -276,7 +276,10 @@ if ($getimage) {
fatal("Could not get the image lock after a long time");
}
}
# Run as root to access /proj
$EUID = $UID = 0;
if (! -e $image->path() || $newhash ne $image->hash() || $force) {
$EUID = $UID = $SAVEUID;
#
# When updating an image ...
#
......@@ -325,6 +328,7 @@ if ($getimage) {
$image->MarkUpdate($user);
}
}
$EUID = $UID = $SAVEUID;
$image->Unlock();
}
exit(0);
......
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