Commit b91a121c authored by Wim Van de Meerssche's avatar Wim Van de Meerssche

fixed merge conflict

parents 609dcc2f b5f26869
......@@ -52,6 +52,7 @@ use emdb;
use libtestbed;
use Brand;
use APT_Profile;
use APT_Aggregate;
use APT_Geni;
use Genixmlrpc;
use GeniResponse;
......@@ -954,6 +955,62 @@ sub UpdateImageStatus($$)
return 0;
}
sub AddExtensionHistory($$)
{
my ($self, $reason) = @_;
my $uuid = $self->uuid();
my $safe_text = DBQuoteSpecial($reason);
return DBQueryWarn("update apt_instances set ".
" extension_history=CONCAT($safe_text,".
" IFNULL(extension_history,'')) ".
"where uuid='$uuid'");
}
sub ExtensionRequested($$$)
{
my ($self, $reason, $granted) = @_;
my $uuid = $self->uuid();
my $safe_text = DBQuoteSpecial($reason);
return DBQueryWarn("update apt_instances set ".
" extension_reason=$safe_text,".
" extension_requested=1, ".
" extension_count=extension_count+1, ".
" extension_days=extension_days+${granted} ".
"where uuid='$uuid'");
}
sub BumpExtensionCount($$)
{
my ($self, $granted) = @_;
my $uuid = $self->uuid();
return DBQueryWarn("update apt_instances set ".
" extension_count=extension_count+1, ".
" extension_days=extension_days+${granted} ".
"where uuid='$uuid'");
}
#
# Return the list APT_Aggregate objects for an instance.
#
sub AptAggregateList($)
{
my ($self) = @_;
my @results = ();
foreach my $agg ($self->AggregateList()) {
my $aptagg = APT_Aggregate->Lookup($agg->aggregate_urn());
if (!defined($aptagg)) {
print STDERR "Could not get APT_Aggregate object for $agg\n";
return ();
}
push(@results, $aptagg);
}
return @results;
}
###################################################################
package APT_Instance::Aggregate;
use emdb;
......@@ -1824,7 +1881,7 @@ sub CreateImage($$$$;$$$)
my ($self, $sliver_urn, $imagename, $update_prepare,
$copyback_uuid, $bsname) = @_;
my $authority = $self->GetGeniAuthority();
my$geniuser = $self->instance()->GetGeniUser();
my $geniuser = $self->instance()->GetGeniUser();
my $slice = $self->instance()->GetGeniSlice();
my $context = APT_Geni::GeniContext();
return undef
......
......@@ -112,6 +112,7 @@ use Node;
use libtestbed;
use emutil;
use libEmulab;
use GeniResponse;
use APT_Instance;
use POSIX qw(strftime ceil);
......@@ -501,7 +502,9 @@ sub PushUpdates()
$genislice->UnLock();
system("$SUDO -u $PROTOUSER $MANAGEINSTANCE updatekeys $uuid");
if ($?) {
$instance->Update({"needupdate" => 1});
if ($? >> 8 != GENIRESPONSE_REFUSED) {
$instance->Update({"needupdate" => 1});
}
}
skip:
$genislice->Flush();
......
......@@ -43,9 +43,10 @@ sub usage()
print "Usage: quickvm [-u uuid] [--site site:1=aggregate ...] <xmlfile>\n";
exit(1);
}
my @optlist = ('d', 'v', 'u=s', 'a=s', 'S', 'k=s');
my @optlist = ('d', 'v', 'u=s', 'a=s', 'S', 'k=s', 'i');
my $debug = 0;
my $verbose = 1;
my $ignorefailures = 0;
my $xmlfile;
my $webtask;
my $webtask_id;
......@@ -148,6 +149,9 @@ if (defined($options{"k"})) {
if (defined($options{"d"})) {
$debug = 1;
}
if (defined($options{"i"})) {
$ignorefailures = 1;
}
if (defined($options{"v"})) {
$verbose = 1;
}
......@@ -932,7 +936,12 @@ foreach my $aggobj (@aggregate_list) {
$slice->UnLock();
if ($failed) {
$instance->SetStatus("failed");
if ($ignorefailures) {
$instance->SetStatus("ready");
}
else {
$instance->SetStatus("failed");
}
# Webtask exit status set above.
$instance->RecordError($webtask->exitcode(),
(defined($webtask->output()) ?
......
This diff is collapsed.
......@@ -292,6 +292,7 @@ int parse_top(tb_vgraph &vg, istream& input)
l->allow_trivial = false;
#endif
l->emulated = false;
l->allow_interswitch = true;
l->fix_src_iface = false;
l->fix_dst_iface = false;
......@@ -304,6 +305,8 @@ int parse_top(tb_vgraph &vg, istream& input)
l->emulated = true;
} else if (parsed_line[i] == string("trivial_ok")) {
l->allow_trivial = true;
} else if (parsed_line[i] == string("no_interswitch")) {
l->allow_interswitch = false;
} else if (stag == string("fixsrciface")) {
l->fix_src_iface = true;
l->src_iface = svalue;
......
......@@ -359,6 +359,13 @@ float find_link_resolutions(resolution_vector &resolutions, pvertex pv,
<< endl);
}
}
// If we're not allowed to use interswitch links for this vlink, just
// skip all of the attempts to find interswitch links
if (!vlink->allow_interswitch){
// Bad Rob, no GOTO
goto skip_interswitch_links;
}
for (pvertex_set::iterator source_switch_it = pnode->switches.begin();
source_switch_it != pnode->switches.end();
++source_switch_it) {
......@@ -487,6 +494,8 @@ float find_link_resolutions(resolution_vector &resolutions, pvertex pv,
}
}
skip_interswitch_links:
return total_weight;
}
......
......@@ -211,6 +211,7 @@ public:
// but isn't.
bool allow_delayed; // can this vlink by a delayed link
bool allow_trivial; // can this vlink be a trivial link?
bool allow_interswitch; // can this vlink be an interswitch link?
vvertex src, dst; // Source and destination for this link
};
......
......@@ -553,8 +553,8 @@ if [ -x /usr/sbin/ntpdate ]; then
fi
# Enable IPoD
if [ -r $BINDIR/rc.ipod ]; then
. $BINDIR/rc.ipod
if [ -x $BINDIR/rc.ipod ]; then
$BINDIR/rc.ipod
fi
#
......
#! /bin/sh
#
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -112,4 +112,4 @@ if [ x"$IPODINFO" != x ]; then
else
echo "*** WARNING: no IPOD info, not enabled"
fi
exit 0
#!/usr/bin/perl -wT
#
# Copyright (c) 2013-2015 University of Utah and the Flux Group.
# Copyright (c) 2013-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -464,7 +464,17 @@ sub freenasVolumeList($;$)
if ($snapinfo) {
my $sref = $snaps{$zvol->{'path'}};
if ($sref && @$sref > 0) {
$vol->{'snapshots'} = join(',', @$sref);
#
# For convenience of the caller, who typically only cares
# about the most recent snapshot, we sort the snapshot
# list from newest to oldest.
#
# XXX note that we can just (reverse) sort lexically since
# the timestamp suffix is fixed in length. Well technically
# it is not fixed-length, but it won't go to 11 digits for
# another 270 years or so...
#
$vol->{'snapshots'} = join(',', sort {$b cmp $a} @$sref);
}
my $sname = $clones{$zvol->{'path'}};
if ($sname) {
......
#!/usr/bin/perl -wT
#
# Copyright (c) 2013-2015 University of Utah and the Flux Group.
# Copyright (c) 2013-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -621,16 +621,15 @@ sub allocSlice($$$$) {
return -1;
}
#
# For possible later cloning, find the highest numbered snapshot
# Note that the 'snapshots' list returned by freenasVolumeList is
# already sorted from newest to oldest, so we just grab the first one.
#
if (exists($vref->{'snapshots'})) {
my $lastsnap = 0;
foreach my $snap (split(',', $vref->{'snapshots'})) {
if ($snap =~ /@(\d+)$/ && $1 > $lastsnap) {
$lastsnap = $1;
}
}
if ($lastsnap) {
$priv->{'lastsnapshot'} = $lastsnap;
my $snap = (split(',', $vref->{'snapshots'}))[0];
if ($snap =~ /@(\d+)$/) {
$priv->{'lastsnapshot'} = $1;
}
}
......@@ -1434,18 +1433,30 @@ sub deallocSlice($$$$) {
# Check for clone volumes. A clone will have our (vnode_id)
# name and be a "cloneof" a snapshot of this lease.
#
# N.B. we now call Destroy rather than Declone, leaving our
# caller responsible for cleaning up snapshots.
#
if (exists($volumes->{$vnode_id})) {
my $vref = $volumes->{$vnode_id};
my $pool = $vref->{'pool'};
if (exists($vref->{'cloneof'}) &&
$vref->{'cloneof'} =~ /^$bsid\@\d+/) {
return freenasVolumeDestroy($pool, $vnode_id);
my $cloneof = $vref->{'cloneof'};
if (defined($cloneof) && $cloneof =~ /^$bsid\@\d+/ &&
exists($volumes->{$bsid})) {
my $snaps = $volumes->{$bsid}->{'snapshots'};
#
# If we are a clone of the most recent snapshot, just Destroy
# which leaves the clone; otherwise Declone and attempt to
# remove the old snapshot.
#
# Note that we do not use the cached 'lastsnapshot' in our
# private data since that was saved back when we were created
# which could be a long time ago (and hence very stale).
#
if (defined($snaps) && $cloneof eq (split(',', $snaps))[0]) {
return freenasVolumeDestroy($pool, $vnode_id);
}
return freenasVolumeDeclone($pool, $vnode_id);
}
warn("*** WARNING: blockstore_deallocSlice: $volname: ".
"Found stale ephemeral volume '$pool/$vnode_id'");
"Found stale clone volume '$pool/$vnode_id'");
}
if (exists($volumes->{$bsid})) {
......@@ -1457,10 +1468,12 @@ sub deallocSlice($$$$) {
}
#
# We use Declone here which will remove the origin snapshot
# as well (if we are the last user) when invoked on a cloned volume.
# Ephemeral volume. We use Declone here rather than Destroy since someday
# we will have clones of ephemeral volumes. In that case we will not have
# to worry about keeping the latest snapshot as there will only be one
# and it should go away on last use.
#
return freenasVolumeDestroy($bsid, $vnode_id);
return freenasVolumeDeclone($bsid, $vnode_id);
}
# Required perl foo
......
#!/bin/sh
#
# Copyright (c) 2014 University of Utah and the Flux Group.
# Copyright (c) 2014-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -36,8 +36,8 @@ else
fi
# Enable IPoD
if [ -r $BINDIR/rc.ipod ]; then
. $BINDIR/rc.ipod
if [ -x $BINDIR/rc.ipod ]; then
$BINDIR/rc.ipod
fi
if [ "$1" = "fail" ]; then
......
#!/bin/sh
#
# Copyright (c) 2000-2015 University of Utah and the Flux Group.
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -530,8 +530,8 @@ if [ -x /usr/sbin/ntpdate ]; then
fi
# Enable IPoD
if [ -r $BINDIR/rc.ipod ]; then
. $BINDIR/rc.ipod
if [ -x $BINDIR/rc.ipod ]; then
$BINDIR/rc.ipod
fi
#
......
#!/bin/sh
#
# Copyright (c) 2000-2015 University of Utah and the Flux Group.
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -528,8 +528,8 @@ if [ -x /usr/sbin/ntpdate ]; then
fi
# Enable IPoD
if [ -r $BINDIR/rc/rc.ipod ]; then
. $BINDIR/rc/rc.ipod
if [ -x $BINDIR/rc/rc.ipod ]; then
$BINDIR/rc/rc.ipod
fi
# Try to map disks to BIOS drive numbers via EDD
......
#! /bin/sh
#
# Copyright (c) 2000-2013 University of Utah and the Flux Group.
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -79,3 +79,4 @@ fi
sysctl -w net.ipv4.icmp_ipod_enabled=1 >/dev/null
echo "$str IPOD enabled from $IPOD_HOST_IP/$IPOD_MASK_IP"
exit 0
......@@ -7014,7 +7014,8 @@ outfiles="$outfiles Makeconf GNUmakefile \
utils/remove_old_www utils/epmodeset \
utils/mkblob utils/rmblob utils/ctrladdr utils/tcppd \
utils/mktestbedtest utils/pxelinux_makeconf \
utils/addvpubaddr utils/attend utils/atten \
utils/addvpubaddr utils/attend utils/atten utils/addrfdevice \
utils/addrfpath \
www/GNUmakefile www/defs.php3 www/dbdefs.php3 www/xmlrpc.php3 \
www/xmlrpcpipe.php3 \
www/swish.conf www/websearch \
......
......@@ -1357,7 +1357,8 @@ outfiles="$outfiles Makeconf GNUmakefile \
utils/remove_old_www utils/epmodeset \
utils/mkblob utils/rmblob utils/ctrladdr utils/tcppd \
utils/mktestbedtest utils/pxelinux_makeconf \
utils/addvpubaddr utils/attend utils/atten \
utils/addvpubaddr utils/attend utils/atten utils/addrfdevice \
utils/addrfpath \
www/GNUmakefile www/defs.php3 www/dbdefs.php3 www/xmlrpc.php3 \
www/xmlrpcpipe.php3 \
www/swish.conf www/websearch \
......
#!/usr/bin/perl -wT
#
# Copyright (c) 2012-2015 University of Utah and the Flux Group.
# Copyright (c) 2012-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -513,21 +513,20 @@ sub Reserve($$$$$)
if ($current_size);
}
# Leases do not require any further size accounting updates.
goto done
if ($self->lease_idx() > 0);
#
# Now do an atomic update that changes both tables.
#
if (!DBQueryWarn("update blockstore_state,reserved_blockstores set ".
" remaining_capacity=remaining_capacity-${bs_size}, ".
" size='$bs_size' ".
"where blockstore_state.bsidx=reserved_blockstores.bsidx and ".
" blockstore_state.bs_id=reserved_blockstores.bs_id and ".
" reserved_blockstores.bsidx='$bsidx' and ".
" reserved_blockstores.exptidx='$exptidx' and ".
" reserved_blockstores.vnode_id='$vnode_id'")) {
# Note: leases do not require this.
#
if ($self->lease_idx() == 0 &&
!DBQueryWarn("update blockstore_state,reserved_blockstores set ".
" remaining_capacity=remaining_capacity-${bs_size}, ".
" size='$bs_size' ".
"where ".
" blockstore_state.bsidx=reserved_blockstores.bsidx and".
" blockstore_state.bs_id=reserved_blockstores.bs_id and".
" reserved_blockstores.bsidx='$bsidx' and ".
" reserved_blockstores.exptidx='$exptidx' and ".
" reserved_blockstores.vnode_id='$vnode_id'")) {
goto bad;
}
done:
......@@ -766,6 +765,7 @@ sub IsReadOnly($) {
#
sub HowUsed($) {
my ($self) = @_;
require VirtExperiment;
my $rethash = {
'readonly' => 0,
......@@ -845,18 +845,32 @@ sub Release($)
}
#
# We want to atomically uupdate update remaining_capacity and
# See if there is an associated lease.
#
my $lease_idx = 0;
$query_result =
DBQueryWarn("select lease_idx from blockstores ".
"where bsidx='$bsidx'");
if ($query_result && $query_result->numrows) {
$lease_idx = $query_result->fetchrow_array();
}
#
# We want to atomically update remaining_capacity and
# set the size in the reservation to zero, so that if we fail,
# nothing has changed.
#
if (!DBQueryWarn("update blockstore_state,reserved_blockstores set ".
" remaining_capacity=remaining_capacity+size, ".
" size=0 ".
"where blockstore_state.bsidx=reserved_blockstores.bsidx and ".
" blockstore_state.bs_id=reserved_blockstores.bs_id and ".
" reserved_blockstores.bsidx='$bsidx' and ".
" reserved_blockstores.exptidx='$exptidx' and ".
" reserved_blockstores.vnode_id='$vnode_id'")) {
# Note: leases do not require this.
#
if ($lease_idx == 0 &&
!DBQueryWarn("update blockstore_state,reserved_blockstores set ".
" remaining_capacity=remaining_capacity+size, ".
" size=0 ".
"where ".
" blockstore_state.bsidx=reserved_blockstores.bsidx and".
" blockstore_state.bs_id=reserved_blockstores.bs_id and".
" reserved_blockstores.bsidx='$bsidx' and".
" reserved_blockstores.exptidx='$exptidx' and".
" reserved_blockstores.vnode_id='$vnode_id'")) {
goto bad;
}
# That worked, so now we can delete the reservation row.
......@@ -874,19 +888,15 @@ sub Release($)
# of the lease.
#
# XXX currently, we also create a new snapshot of the blockstore
# if the blockstore is marked as "multiuse".
# if the blockstore is marked as "multiuse" and is mapped RW.
#
$query_result =
DBQueryWarn("select lease_idx from blockstores ".
"where bsidx='$bsidx'");
if ($query_result && $query_result->numrows) {
if ($lease_idx != 0) {
require Lease;
my ($lidx) = $query_result->fetchrow_array();
my $lease = Lease->Lookup($lidx);
my $lease = Lease->Lookup($lease_idx);
if ($lease) {
$lease->BumpLastUsed();
if (!$lease->IsExclusiveUse() &&
if (!$lease->IsExclusiveUse() && !$self->IsReadOnly() &&
$lease->CreateResourceSnapshot(1)) {
print STDERR "Blockstore->Release: ".
"Could not create snapshot for $bsidx ($lease); ".
......
#!/usr/bin/perl -wT
#
# Copyright (c) 2005-2015 University of Utah and the Flux Group.
# Copyright (c) 2005-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -113,6 +113,16 @@ sub LogsEmailAddress($)
$TBLOGS);
}
sub ExtensionsEmailAddress($)
{
my ($self) = @_;
return ($self->isAPT() ? "portal-extensions\@aptlab.net" :
$self->isCloud() ? "portal-extensions\@cloudlab.us" :
$self->isPNet() ? "portal-extensions\@phantomnet.org" :
$TBOPS);
}
sub EmailTag($)
{
my ($self) = @_;
......
......@@ -182,7 +182,8 @@ $EXPT_RESOURCESHOSED = 0;
"virt_client_service_opts",
"virt_blockstores",
"virt_blockstore_attributes",
"virt_address_allocation");
"virt_address_allocation",
"virt_profile_parameters");
%physicalTables = ("delays" => ["node_id", "vname", "vnode0", "vnode1"],
"v2pmap" => ["node_id", "vname"],
......@@ -6419,5 +6420,40 @@ sub LookupAddressPools($$)
return $result;
}
#
# Add a profile parameter.
#
sub AddProfileParameter($$$)
{
my ($self, $name, $value) = @_;
# Must be a real reference.
return -1
if (! ref($self));
my $pid = $self->pid();
my $eid = $self->eid();
my $exptidx = $self->idx();
if (defined($name)) {
$name = DBQuoteSpecial($name);
} else {
return -1;
}
if (defined($value)) {
$value = DBQuoteSpecial($value);
} else {
$value = "''";
}
DBQueryWarn( "REPLACE INTO virt_profile_parameters SET pid='$pid', " .
"eid='$eid', exptidx='$exptidx', name=$name, " .
"value=$value" )
or return -1;
return 0;
}
# _Always_ make sure that this 1 is at the end of the file...
1;
#!/usr/bin/perl -wT
#
# Copyright (c) 2012-2015 University of Utah and the Flux Group.
# Copyright (c) 2012-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -475,10 +475,13 @@ sub InUseReadWrite() {
if (!ref($self));
my $resvref = $self->GetReservations();
if ($resvref && @$resvref) {
# We only need to check the first reservation in the list since no
# concurrent mix of RO and RW is allowed.
$rw = $resvref->[0]->IsReadOnly() ? 0 : 1;
if ($resvref) {
foreach my $ref (@$resvref) {
if (!$ref->IsReadOnly()) {
$rw = 1;
last;
}
}
}
return $rw;
......
......@@ -1373,7 +1373,9 @@ sub Cancel
sub GetOpState
{
my ($sliver) = @_;