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
c3f5359b
Commit
c3f5359b
authored
Oct 20, 2016
by
Mike Hibler
Browse files
Reapply clone changes from
72fb6763
.
Got lost in Leigh's last commit.
parent
50008b82
Changes
1
Hide whitespace changes
Inline
Side-by-side
tbsetup/ptopgen.in
View file @
c3f5359b
...
...
@@ -1690,15 +1690,42 @@ foreach $node (@nodenames) {
#
# Print out all blockstores
#
# XXX we should try to narrow down the list of lease blockstores to only
# those accessible by this user/project.
#
if
(
$useblockstore
)
{
$result
=
DBQueryFatal
("
select b.node_id, b.bs_id, b.lease_idx, b.type,
"
.
"
s.remaining_capacity
"
.
"
s.remaining_capacity
, b2.bs_id as pool
"
.
"
from blockstores as b
"
.
"
left join blockstore_state as s
"
.
"
on b.bsidx=s.bsidx
"
.
"
left join blockstore_trees as t
"
.
"
on b.bsidx=t.bsidx
"
.
"
left join blockstores as b2
"
.
"
on t.aggidx=b2.bsidx
"
.
"
where s.ready=1
");
#
# Pass 1: associate leases with pools
#
my
@rows
=
();
my
%bspools
=
();
while
(
my
(
$nodeId
,
$bsId
,
$leaseIdx
,
$typeName
,
$capacity
)
=
$result
->
fetchrow_array
)
{
$capacity
,
$pool
)
=
$result
->
fetchrow_array
)
{
if
(
$pool
)
{
my
$key
=
"
$nodeId
/
$pool
";
if
(
!
exists
(
$bspools
{
$key
}))
{
$bspools
{
$key
}
=
[]
;
}
push
(
@
{
$bspools
{
$key
}},
$leaseIdx
);
}
push
(
@rows
,
[
$nodeId
,
$bsId
,
$leaseIdx
,
$typeName
,
$capacity
]);
}
#
# Pass 2: output the blockstores
#
foreach
my
$row
(
@rows
)
{
my
(
$nodeId
,
$bsId
,
$leaseIdx
,
$typeName
,
$capacity
)
=
@$row
;
my
$type
=
BlockstoreType
->
Lookup
(
$typeName
);
if
(
defined
(
$type
))
{
my
@features
=
();
...
...
@@ -1727,6 +1754,16 @@ if ($useblockstore) {
if
(
$leaseIdx
>
0
)
{
push
(
@features
,
"
bs-lease-
$leaseIdx
:1.0
");
}
#
# If it is not a lease, we need to see if it is the home
# of any leases. If so we output a unique feature to say
# that this pool supports clones of the indicated lease.
#
elsif
(
exists
(
$bspools
{"
$nodeId
/
$bsId
"}))
{
foreach
my
$lidx
(
@
{
$bspools
{"
$nodeId
/
$bsId
"}})
{
push
(
@features
,
"
bs-clone-
$lidx
:0.5
");
}
}
push
(
@features
,
"
+bs-capacity:
$capacity
");
print_node
("
$nodeId
:
$bsId
",
["
blockstore:
$slots
"],
\
@features
,
...
...
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