Commit 285a9b46 authored by Mike Hibler's avatar Mike Hibler

Merge branch 'master' into arm64

parents e563064f d29bb148
...@@ -355,6 +355,10 @@ foreach my $iid (sort keys %iinfo) { ...@@ -355,6 +355,10 @@ foreach my $iid (sort keys %iinfo) {
print STDERR "Must specify imagename\n"; print STDERR "Must specify imagename\n";
exit(0); exit(0);
} }
if (!defined($iinfo{$iid}{'method'})) {
print STDERR "Must specify method\n";
exit(0);
}
if ($iinfo{$iid}{'method'} eq "frisbee") { if ($iinfo{$iid}{'method'} eq "frisbee") {
$dofrisbee++; $dofrisbee++;
if (!defined($iinfo{$iid}{'server'})) { if (!defined($iinfo{$iid}{'server'})) {
......
...@@ -31,6 +31,7 @@ use Exporter; ...@@ -31,6 +31,7 @@ use Exporter;
existsBridge findBridge findBridgeIfaces existsBridge findBridge findBridgeIfaces
downloadImage getKernelVersion createExtraFS downloadImage getKernelVersion createExtraFS
forwardPort removePortForward lvSize DoIPtables restartDHCP forwardPort removePortForward lvSize DoIPtables restartDHCP
computeStripeSize
); );
use Data::Dumper; use Data::Dumper;
...@@ -318,6 +319,30 @@ isdisk: ...@@ -318,6 +319,30 @@ isdisk:
return %retval; return %retval;
} }
#
# Attempt to compute a stripe size, based on physical number of
# devices in the volume group.
#
sub computeStripeSize($)
{
my ($vgname) = @_;
my $command = "vgdisplay -v $vgname 2>/dev/null | ".
"awk '/PV Name/ {print \$3}'";
my %devices = ();
my $count = 1;
if (open(PFD, "$command |")) {
while (my $line = <PFD>) {
if ($line =~ /\/dev\/(\w{2,3})/) {
$devices{$1} = $1;
}
}
close(PFD);
$count = scalar(keys(%devices));
}
return $count;
}
my %if2mac = (); my %if2mac = ();
my %mac2if = (); my %mac2if = ();
my %ip2if = (); my %ip2if = ();
......
...@@ -43,6 +43,7 @@ my $NTPDRIFT1 = "/etc/ntp/drift"; ...@@ -43,6 +43,7 @@ my $NTPDRIFT1 = "/etc/ntp/drift";
my $NTPDRIFT2 = "/var/lib/ntp/drift"; my $NTPDRIFT2 = "/var/lib/ntp/drift";
my $SFSUSERS = "/etc/sfs/sfs_users"; my $SFSUSERS = "/etc/sfs/sfs_users";
my $SFSHOSTKEY = "/etc/sfs/sfs_host_key"; my $SFSHOSTKEY = "/etc/sfs/sfs_host_key";
my $SSHDCONFIG = "/etc/ssh/sshd_config";
my $VARACCTDIR = "/var/account"; my $VARACCTDIR = "/var/account";
my $VARACCTSDIR = "/var/log/sa"; my $VARACCTSDIR = "/var/log/sa";
my $IFTAB = "/etc/iftab"; my $IFTAB = "/etc/iftab";
...@@ -416,6 +417,14 @@ foreach my $file (@SOCKETS) { ...@@ -416,6 +417,14 @@ foreach my $file (@SOCKETS) {
} }
} }
print "Removing extra Ports from $SSHDCONFIG\n";
if (-e $SSHDCONFIG) {
# Remove high numbered ports.
system("sed -i.bak -e '/^Port [0-9]\{3,\}/d' $SSHDCONFIG");
warn("*** Could not remove Port lines\n")
if ($?);
}
# Leave this print statement here; create_image depends on it. # Leave this print statement here; create_image depends on it.
print "prepare ran successfully!\n"; print "prepare ran successfully!\n";
exit 0; exit 0;
......
...@@ -30,7 +30,8 @@ BEGIN { require "/etc/emulab/paths.pm"; import emulabpaths; } ...@@ -30,7 +30,8 @@ BEGIN { require "/etc/emulab/paths.pm"; import emulabpaths; }
my $VIMAGE = "/usr/local/bin/create-versioned-image"; my $VIMAGE = "/usr/local/bin/create-versioned-image";
my $zipper = "/usr/local/bin/imagezip"; my $zipper = "/usr/local/bin/imagezip";
my $uploader = "/usr/local/bin/frisupload"; my $uploader = "$BINDIR/frisupload";
my $uploader_alt= "/usr/local/bin/frisupload";
my $VNODESETUP = "$BINDIR/vnodesetup"; my $VNODESETUP = "$BINDIR/vnodesetup";
my $CAPTURE = "$BINDIR/capturevm.pl"; my $CAPTURE = "$BINDIR/capturevm.pl";
my $EXTRAFS = "/capture"; my $EXTRAFS = "/capture";
...@@ -66,6 +67,10 @@ use libsetup; ...@@ -66,6 +67,10 @@ use libsetup;
use libvnode_xen; use libvnode_xen;
use libutil; use libutil;
# Location confusion.
$uploader = $uploader_alt
if (! -x $uploader);
# #
# No configure vars. # No configure vars.
# #
......
...@@ -222,6 +222,9 @@ my $RTTABLES = "/etc/iproute2/rt_tables"; ...@@ -222,6 +222,9 @@ my $RTTABLES = "/etc/iproute2/rt_tables";
# Temporary; later kernel version increases this. # Temporary; later kernel version increases this.
my $MAXROUTETTABLE = 255; my $MAXROUTETTABLE = 255;
# Striping
my $STRIPE_COUNT = 1;
# Whether or not to use only unpartitioned (unused) disks to form the Xen VG. # Whether or not to use only unpartitioned (unused) disks to form the Xen VG.
my $LVM_FULLDISKONLY = 0; my $LVM_FULLDISKONLY = 0;
...@@ -310,16 +313,10 @@ sub init($) ...@@ -310,16 +313,10 @@ sub init($)
} }
getXenInfo(); getXenInfo();
# # Compute the strip size for new lvms.
# The 4.4 image has to use the openvswitch package instead of building if (-e "/var/run/xen.ready") {
# from source since the current release does not support the kernel. $STRIPE_COUNT = computeStripeSize($VGNAME);
# And the package is installed in a different place.
#
if ($xeninfo{xen_minor} >= 4) {
$OVSCTL = "/usr/bin/ovs-vsctl";
$OVSSTART = "/usr/share/openvswitch/scripts/ovs-ctl";
} }
return 0; return 0;
} }
...@@ -470,9 +467,9 @@ sub rootPreConfig($) ...@@ -470,9 +467,9 @@ sub rootPreConfig($)
} }
# #
# Make sure pieces are at least a GiB. # Make sure pieces are at least a 5GiB.
# #
my %devs = libvnode::findSpareDisks(1 * 1024); my %devs = libvnode::findSpareDisks(5 * 1024);
# #
# Turn on write caching. Hacky. # Turn on write caching. Hacky.
...@@ -580,6 +577,7 @@ sub rootPreConfig($) ...@@ -580,6 +577,7 @@ sub rootPreConfig($)
" $MAX_VNODES VMs ($size < $XEN_MIN_VGSIZE)\n"; " $MAX_VNODES VMs ($size < $XEN_MIN_VGSIZE)\n";
} }
} }
$STRIPE_COUNT = computeStripeSize($VGNAME);
# #
# Make sure our volumes are active -- they seem to become inactive # Make sure our volumes are active -- they seem to become inactive
...@@ -1484,9 +1482,11 @@ sub vnodePreConfig($$$$$){ ...@@ -1484,9 +1482,11 @@ sub vnodePreConfig($$$$$){
# Testing a theory; remove all this iscsi stuff to see if that # Testing a theory; remove all this iscsi stuff to see if that
# is causing problems with the control network interface going # is causing problems with the control network interface going
# offline after boot. # offline after boot.
if ($xeninfo{xen_minor} < 4) {
mysystem2("/bin/rm -vf $vnoderoot/etc/init/*iscsi*"); mysystem2("/bin/rm -vf $vnoderoot/etc/init/*iscsi*");
mysystem2("/bin/rm -vf $vnoderoot/etc/init.d/*iscsi*"); mysystem2("/bin/rm -vf $vnoderoot/etc/init.d/*iscsi*");
} }
}
else { else {
# #
# XXX We need this for libsetup to know it is in a XENVM. # XXX We need this for libsetup to know it is in a XENVM.
...@@ -2467,7 +2467,8 @@ sub CreatePrimaryDisk($$$$) ...@@ -2467,7 +2467,8 @@ sub CreatePrimaryDisk($$$$)
$lv_size += $extrafs * (1024 * 1024); $lv_size += $extrafs * (1024 * 1024);
} }
} }
if (mysystem2("lvcreate -L ${lv_size}k -n $target $VGNAME")) { if (mysystem2("lvcreate -i${STRIPE_COUNT} ".
" -L ${lv_size}k -n $target $VGNAME")) {
print STDERR "libvnode_xen: could not create disk for $target\n"; print STDERR "libvnode_xen: could not create disk for $target\n";
return -1; return -1;
} }
......
...@@ -313,6 +313,13 @@ sub LookupByURL($$) ...@@ -313,6 +313,13 @@ sub LookupByURL($$)
} }
return undef; return undef;
} }
# Image is local if the metadata_url is null.
sub IsLocal($)
{
my ($self) = @_;
return (defined($self->metadata_url()) ? 0 : 1);
}
# #
# Lookup a "system" osid, meaning one in the emulab-ops project. # Lookup a "system" osid, meaning one in the emulab-ops project.
......
...@@ -1029,7 +1029,7 @@ sub HasActualPrivilege($$) ...@@ -1029,7 +1029,7 @@ sub HasActualPrivilege($$)
my ($self, $p) = @_; my ($self, $p) = @_;
return 0 return 0
if (!exists($self->{'capabilities'})); if (!defined($self->{'capabilities'}));
return exists($self->{'capabilities'}->{$p}) ? 1 : 0; return exists($self->{'capabilities'}->{$p}) ? 1 : 0;
} }
......
...@@ -720,7 +720,14 @@ sub SetDiskImage($$) ...@@ -720,7 +720,14 @@ sub SetDiskImage($$)
$diskref = AddElement("disk_image", $type); $diskref = AddElement("disk_image", $type);
} }
} }
if (GeniHRN::IsValid($urn)) {
$diskref->removeAttribute("url");
GeniXML::SetText("name", $diskref, $urn); GeniXML::SetText("name", $diskref, $urn);
}
else {
$diskref->removeAttribute("name");
GeniXML::SetText("url", $diskref, $urn);
}
return $diskref; return $diskref;
} }
......
#!/usr/bin/perl -w #!/usr/bin/perl -w
# #
# Copyright (c) 2003-2012 University of Utah and the Flux Group. # Copyright (c) 2003-2014 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -149,7 +149,15 @@ while (my ($vname, $osname) = $result->fetchrow()) { ...@@ -149,7 +149,15 @@ while (my ($vname, $osname) = $result->fetchrow()) {
# fetch the image file, or refetch if it is stale. # fetch the image file, or refetch if it is stale.
# #
my $image = Image->LookupByURL($url); my $image = Image->LookupByURL($url);
if (!defined($image)) { if (defined($image)) {
#
# LookupByURL might return a local image, which of course
# we want to skip; later phases know its a local image.
#
next
if ($image->IsLocal());
}
else {
my $opts = ""; my $opts = "";
$opts .= " -d" $opts .= " -d"
if ($debug); if ($debug);
...@@ -162,10 +170,12 @@ while (my ($vname, $osname) = $result->fetchrow()) { ...@@ -162,10 +170,12 @@ while (my ($vname, $osname) = $result->fetchrow()) {
next next
if ($verify); if ($verify);
if (!defined($image)) {
$image = Image->LookupByURL($url); $image = Image->LookupByURL($url);
if (!defined($image)) { if (!defined($image)) {
tbdie("Could not look up image object for $url\n"); tbdie("Could not look up image object for $url\n");
} }
}
next next
if (! $getimages); if (! $getimages);
......
...@@ -720,10 +720,12 @@ if (defined($webtask)) { ...@@ -720,10 +720,12 @@ if (defined($webtask)) {
} }
# #
# Be sure to kill off running frisbee. If a node is trying to load that # Slight problem here; killing off the running frisbeed will cause
# image, well tough. # any experiment trying to load that image, to blow up. So we
# do not want to do this for system images, but for project images
# this is generally okay to do.
# #
if (0) { if ($pid ne TBOPSPID()) {
system("$friskiller -k $imageid"); system("$friskiller -k $imageid");
if ($?) { if ($?) {
fatal("Could not kill running frisbee for $imageid!"); fatal("Could not kill running frisbee for $imageid!");
......
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