Commit bb2563cf authored by Kirk Webb's avatar Kirk Webb

Parser hacks for blockstores

* Translate bandwidth spec "~" to 10Kbps, and complain if any other value
  is used on a lan with blockstores.

* Allow blockstores to be fixed to nodes.  Shunt through cases where the
  node a blockstore is fixed to isn't a blockstore pseudo-VM via a
  features / desires hack.  We do this to avoid having a more heavyweight
  blockstore pseudo-VM representation show up when users just want more
  local disk space setup on their nodes.
parent ffe332be
......@@ -1553,6 +1553,13 @@ sub LoadVirtNodes($)
return -1;
}
# XXX: If the virt blockstore object isn't fixed to a
# blockstore pseudo-VM, then abort the bookkeeping and mapping
# for it. This means we are dealing with local node storage
# via a features and desires hack.
next
if $fixnode->type() ne "blockstore";
#
# We need a place to hang the attributes, but they are split
# between the blockstore and the blockstore_attributes. Another
......
......@@ -98,6 +98,8 @@ Blockstore instproc set-type {newtype} {
}
Blockstore instproc set-size {newsize} {
$self instvar node
set mindisksize 1; # 1 MiB
# Convert various input size strings to mebibytes.
......@@ -109,10 +111,39 @@ Blockstore instproc set-size {newsize} {
return
}
# Hack/shortcut for local nodes. If the blockstore is fixed to
# 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
}
$self set size $convsize
return
}
#
# Explicitly fix a blockstore to a node.
#
Blockstore instproc set_fixed {pnode} {
$self instvar node
$self instvar size
if { [$pnode info class] != "Node" } {
perror "Can only fix blockstores to a node object!"
return
}
# Hack/shortcut for local nodes. If the blockstore is fixed to
# 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 node $pnode
return
}
# Create a node object to represent the host that contains this blockstore,
# or return it if it already exists.
......
......@@ -309,6 +309,11 @@ LanLink instproc init {s nodes bw d type} {
set bs $node
set node [$bs get_node]
$self set sanlan 1
# XXX: see comment in parse_bw() in parse.tcl
if {$bw != 10} {
perror "Only '~' (indicating best-effort) is supported as the bandwidth for network links/lans containing storage members."
return
}
}
set nodepair [list $node [$node add_lanlink $self]]
set bandwidth($nodepair) $bw
......
......@@ -564,9 +564,17 @@ proc parse_bw {bspec {islink 1}} {
# "*" means let assign pick the bandwidth. Make it zero.
# "~" means "best effort" bandwidth - not conservatively allocated.
#
if {"$bspec" == "*" || "$bspec" == "~"} {
if {"$bspec" == "*"} {
return 0
}
if {"$bspec" == "~"} {
# XXX: this is not the right way to handle this. However, since
# it's only supposed to be used for sanlans with no shaping
# (enforced in lanlink.tcl), this is WAAAY easier than trying
# to feed some new flag or sentinel value down into the guts
# of the mapper.
return 10
}
# Default to bytes
if {[scan $bspec "%f%s" bw unit] == 1} {
......
......@@ -1092,7 +1092,8 @@ proc tb-set-link-failure-action {lanlink type} {
}
proc tb-fix-node {vnode pnode} {
if {[$vnode info class] != "Node"} {
if {[$vnode info class] != "Node" ||
[$vnode info class] != "Blockstore"} {
perror "\[tb-fix-node] $vnode is not a node."
return
}
......
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