Skip to content
GitLab
Menu
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
780d4c63
Commit
780d4c63
authored
Nov 27, 2013
by
Mike Hibler
Browse files
Added LookupByLease() to lookup based on lease_idx.
parent
dbb1e58d
Changes
1
Hide whitespace changes
Inline
Side-by-side
db/Blockstore.pm
View file @
780d4c63
...
...
@@ -67,6 +67,27 @@ sub Lookup($$$)
return
$self
;
}
sub
LookupByLease
($$)
{
my
(
$class
,
$leaseidx
)
=
@_
;
return
undef
if
(
!
(
$leaseidx
&&
$leaseidx
=~
/^\d+$/
));
my
$query_result
=
DBQueryWarn
("
select * from blockstores where lease_idx='
$leaseidx
'
");
return
undef
if
(
!
$query_result
||
!
$query_result
->
numrows
);
my
$self
=
{};
$self
->
{"
HASH
"}
=
{};
$self
->
{"
DBROW
"}
=
$query_result
->
fetchrow_hashref
();
bless
(
$self
,
$class
);
return
$self
;
}
# To avoid writing out all the methods.
AUTOLOAD
{
my
$self
=
$_
[
0
];
...
...
@@ -292,6 +313,14 @@ sub Partition($$$$$)
my
$remaining_capacity
;
my
$new_bs
;
#
# Make sure it doesn't already exist
#
if
(
Blockstore
->
Lookup
(
$bs_node_id
,
$pbs_name
))
{
print
STDERR
"
Partition blockstore
$bs_node_id
/
$pbs_name
already exists
\n
";
return
undef
;
}
#
# Make sure we have an entry for the new blockstore.
# XXX we do this before we lock the tables since Create accesses
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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