Commit d981ca72 authored by Kirk Webb's avatar Kirk Webb

Support multiple blockstores per local node.

parent bb2563cf
......@@ -115,7 +115,11 @@ Blockstore instproc set-size {newsize} {
# anything other than a blockstore pseudo-VM, then just attach a
# desire to the parent node indicating a need for disk space.
if { $node != {} && [$node set type] != "Blockstore" } {
$node add-desire "?+disk" $convsize
set cursize [$node get-desire "?+disk"]
if {$cursize == {}} {
set cursize 0
}
$node add-desire "?+disk" [expr $convsize + $cursize] 1
}
$self set size $convsize
......@@ -138,7 +142,11 @@ Blockstore instproc set_fixed {pnode} {
# anything other than a blockstore pseudo-VM, then just attach a
# desire to the parent node indicating a need for disk space.
if { $size != 0 && [$pnode set type] != "Blockstore" } {
$pnode add-desire "?+disk" $size
set cursize [$pnode get-desire "?+disk"]
if {$cursize == {}} {
set cursize 0
}
$pnode add-desire "?+disk" [expr $size + $cursize] 1
}
set node $pnode
......
......@@ -680,17 +680,32 @@ Node instproc start-command {command} {
#
# Add a desire to the node, with the given weight
# Fails if the desire already exists, but maybe it could just update the
# weight?
# Fails if the desire already exists unless the override parameter is
# set.
#
Node instproc add-desire {desire weight} {
Node instproc add-desire {desire weight {override 0}} {
$self instvar desirelist
if {[info exists desirelist($desire)]} {
if {[info exists desirelist($desire)] && !$override} {
perror "\[add-desire] Desire $desire on $self already exists!"
}
set desirelist($desire) $weight
}
#
# Grab a desire that was already set. return empty string if it is not set.
#
Node instproc get-desire {desire} {
$self instvar desirelist
# desire exists.
if {[info exists desirelist($desire)]} {
return [set desirelist($desire)]
}
# desire does not exist.
return {}
}
#
# Add a key/value pair to the nide.
#
......
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