</description>
</hash>
</collection>
-
+
+ <collection name="vdevmap">
+ <collection name="x" type="sybmolic">
+ <description>'x' is an arbitrary name, replace it with e.g. device names</description>
+ <boolean name="open">
+ <description>When this file exists, the device can be opened</description>
+ </boolean>
+ <boolean name="create">
+ <description>When this file exists, the device can be created (if the guest has <optionref ref="bcapabilities">CAP_MKNOD</optionref>)</description>
+ </boolean>
+ <boolean id="guest-vdevmap-remap" name="remap">
+ <description>
+When this file exists, <optionref ref="guest-vdevmap-target">target</optionref> will
+have to exist as well and opening the device will in fact open the target device
+ </description>
+ </boolean>
+ <scalar name="flags">
+ <description>This file will let you specify unimplemented flags manually</description>
+ </scalar>
+ <scalar name="device">
+ <description>Contains the name of a device node</description>
+ </scalar>
+ <scalar id="guest-vdevmap-target" name="target">
+ <description>Contains the device node of the target node to open instead of the device when <optionref ref="guest-vdevmap-remap">remap</optionref> is set</description>
+ </scalar>
+ </collection>
+ </collection>
+
<collection name="vshelper">
<scalar name="sync-timeout">
<default>30</default>
eend $?
ebegin "Loading default device map"
- $__PKGLIBDIR/bash-wrapper 'loadDeviceMap 0 "$__CONFDIR/.defaults/apps/vdevmap"'
+ $__PKGLIBDIR/bash-wrapper 'handleDeviceMap --set 0 "$__CONFDIR/.defaults/apps/vdevmap"'
eend $?
}
done
}
-function loadDeviceMap
+function handleDeviceMap
{
- local xid="$1"
- local dir="$2"
+ local op="$1"
+ local xid="$2"
+ local dir="$3"
local flags device target
test -d "$dir" || return 0
+ test -n "$xid" || return 0
for i in "$dir"/*; do
test -d "$i" || continue
vdevmap_opts=( "${vdevmap_opts[@]}" ${flags:+--flags "$flags"} \
${device:+--device "$device"} ${target:+--target "$target"} )
- $_VDEVMAP --xid "$xid" --set "${vdevmap_opts[@]}" || return $?
+ $_VDEVMAP --xid "$xid" "$op" "${vdevmap_opts[@]}" || return $?
done
}
enableInterfaces "$VSERVER_DIR" && have_interfaces=1
-mountVserver "$VSERVER_DIR" && is_mounted=1
-prepareInit "$VSERVER_DIR"
-addtoCPUSET "$VSERVER_DIR"
+mountVserver "$VSERVER_DIR" && is_mounted=1
+prepareInit "$VSERVER_DIR"
+addtoCPUSET "$VSERVER_DIR"
+
+handleDeviceMap --set "$S_CONTEXT" "$VSERVER_DIR/apps/vdevmap"
pushd "$VSERVER_DIR"/vdir/ >/dev/null
execScriptlets "$VSERVER_DIR" "$VSERVER_NAME" pre-start
echo $"Vserver '$VSERVER_DIR' still running unexpectedly; please investigate it manually..." >&2
execScriptlets "$VSERVER_DIR" "$VSERVER_NAME" post-stop
-
+
+handleDeviceMap --unset "$S_CONTEXT" "$VSERVER_DIR/apps/vdevmap"
+
umountVserver "$VSERVER_DIR" || :
disableInterfaces "$VSERVER_DIR"
_endResult $?
local retval=$?
_beginResult $"Loading default device map"
- loadDeviceMap 0 "$__CONFDIR/.defaults/apps/vdevmap"
+ handleDeviceMap --set 0 "$__CONFDIR/.defaults/apps/vdevmap"
_endResult $?
test "$retval" -ne 0 || touch "$lockfile"
return $retval