Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
6498e1ef
Commit
6498e1ef
authored
Jan 22, 2014
by
Mike Hibler
Browse files
Check for and disallow attempts to RW map a lease in the 'grace' state.
parent
59b1c489
Changes
1
Hide whitespace changes
Inline
Side-by-side
tbsetup/libvtop_test.pm.in
View file @
6498e1ef
...
...
@@ -1613,6 +1613,19 @@ sub LoadVirtNodes($)
$self->{'COUNTERS'}->{'bstorecount'}++;
}
#
# Make a quick pass of the virt_blockstores looking for RO attributes.
# We do this before we make the main pass below so that we have this
# info available when we lookup a lease.
#
my %roleases = ();
foreach my $virt_bs_attr ($self->virt_blockstore_attributes()->Rows()) {
if ($virt_bs_attr->attrkey() eq "readonly") {
$roleases{$virt_bs_attr->vname()} = $virt_bs_attr->attrvalue();
}
}
foreach my $virt_bs_attr ($self->virt_blockstore_attributes()->Rows()) {
my $vname = $virt_bs_attr->vname();
my $attrkey = $virt_bs_attr->attrkey();
...
...
@@ -1624,7 +1637,12 @@ sub LoadVirtNodes($)
# attribute) then make sure the user/pid have access to the lease
# and that the associated blockstore is not already mapped.
# If it is currently in use, the remaining capacity will be zero.
# Note: we do not make this check during a pre-assign pass.
#
# We also check and make sure that leases in the grace state are
# only mounted RO. We make this check in the parser as well, but
# the state of the lease can change between parses.
#
# Note: we do not make these checks during a pre-assign pass.
#
if ($attrkey eq "lease" && !$self->preassign()) {
my $lease = Lease->Lookup($attrval);
...
...
@@ -1641,6 +1659,11 @@ sub LoadVirtNodes($)
tberror("Persistent blockstore $vname is already in use.\n");
return -1;
}
if ($lease->state() eq LEASE_STATE_GRACE() &&
(!exists($roleases{$vname}) || $roleases{$vname} == 0)) {
tberror("Persistent blockstore $vname in grace period, must specify '\$$vname set-readonly 1' in NS file.\n");
return -1;
}
}
# Skip any blockstores that don't have a corresponding entry in the
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment