Changeset 2624

Show
Ignore:
Timestamp:
10/15/07 13:31:52 (1 year ago)
Author:
dhozac
Message:

Add support for per-guest device maps.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/doc/configuration.xml

    r2623 r2624  
    786786        </hash> 
    787787      </collection> 
    788        
     788 
     789      <collection name="vdevmap"> 
     790        <collection name="x" type="sybmolic"> 
     791          <description>'x' is an arbitrary name, replace it with e.g. device names</description> 
     792          <boolean name="open"> 
     793            <description>When this file exists, the device can be opened</description> 
     794          </boolean> 
     795          <boolean name="create"> 
     796            <description>When this file exists, the device can be created (if the guest has <optionref ref="bcapabilities">CAP_MKNOD</optionref>)</description> 
     797          </boolean> 
     798          <boolean id="guest-vdevmap-remap" name="remap"> 
     799            <description> 
     800When this file exists, <optionref ref="guest-vdevmap-target">target</optionref> will 
     801have to exist as well and opening the device will in fact open the target device 
     802            </description> 
     803          </boolean> 
     804          <scalar name="flags"> 
     805            <description>This file will let you specify unimplemented flags manually</description> 
     806          </scalar> 
     807          <scalar name="device"> 
     808            <description>Contains the name of a device node</description> 
     809          </scalar> 
     810          <scalar id="guest-vdevmap-target" name="target"> 
     811            <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> 
     812          </scalar> 
     813        </collection> 
     814      </collection> 
     815   
    789816      <collection name="vshelper"> 
    790817        <scalar name="sync-timeout"> 
  • trunk/gentoo/util-vserver

    r2573 r2624  
    4343 
    4444        ebegin "Loading default device map" 
    45         $__PKGLIBDIR/bash-wrapper 'loadDeviceMap 0 "$__CONFDIR/.defaults/apps/vdevmap"' 
     45        $__PKGLIBDIR/bash-wrapper 'handleDeviceMap --set 0 "$__CONFDIR/.defaults/apps/vdevmap"' 
    4646        eend $? 
    4747} 
  • trunk/scripts/vserver.functions

    r2620 r2624  
    12831283} 
    12841284 
    1285 function loadDeviceMap 
    1286 
    1287     local xid="$1" 
    1288     local dir="$2" 
     1285function handleDeviceMap 
     1286
     1287    local op="$1" 
     1288    local xid="$2" 
     1289    local dir="$3" 
    12891290    local flags device target 
    12901291 
    12911292    test -d "$dir" || return 0 
     1293    test -n "$xid" || return 0 
    12921294 
    12931295    for i in "$dir"/*; do 
     
    13051307                        ${device:+--device "$device"} ${target:+--target "$target"} ) 
    13061308 
    1307         $_VDEVMAP --xid "$xid" --set "${vdevmap_opts[@]}" || return $? 
     1309        $_VDEVMAP --xid "$xid" "$op" "${vdevmap_opts[@]}" || return $? 
    13081310    done 
    13091311} 
  • trunk/scripts/vserver.start

    r2620 r2624  
    119119enableInterfaces "$VSERVER_DIR" && have_interfaces=1 
    120120 
    121 mountVserver "$VSERVER_DIR"     && is_mounted=1 
    122 prepareInit  "$VSERVER_DIR" 
    123 addtoCPUSET  "$VSERVER_DIR" 
     121mountVserver     "$VSERVER_DIR" && is_mounted=1 
     122prepareInit      "$VSERVER_DIR" 
     123addtoCPUSET      "$VSERVER_DIR" 
     124 
     125handleDeviceMap --set "$S_CONTEXT" "$VSERVER_DIR/apps/vdevmap" 
    124126 
    125127pushd "$VSERVER_DIR"/vdir/ >/dev/null 
  • trunk/scripts/vserver.stop

    r2602 r2624  
    104104 
    105105execScriptlets    "$VSERVER_DIR" "$VSERVER_NAME" post-stop 
    106      
     106 
     107handleDeviceMap --unset "$S_CONTEXT" "$VSERVER_DIR/apps/vdevmap" 
     108 
    107109umountVserver     "$VSERVER_DIR" || : 
    108110disableInterfaces "$VSERVER_DIR" 
  • trunk/sysv/util-vserver

    r2513 r2624  
    6363    local retval=$? 
    6464    _beginResult $"Loading default device map" 
    65     loadDeviceMap 0 "$__CONFDIR/.defaults/apps/vdevmap" 
     65    handleDeviceMap --set 0 "$__CONFDIR/.defaults/apps/vdevmap" 
    6666    _endResult $? 
    6767    test "$retval" -ne 0 || touch "$lockfile"