Changeset 2599

Show
Ignore:
Timestamp:
08/26/07 23:30:50 (1 year ago)
Author:
dhozac
Message:

Add support for the lback address in the configuration.
Add --silent to vtag so it'll complain if run manually on a kernel without the necessary support.

Files:

Legend:

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

    r2598 r2599  
    12221222    <collection name="interfaces"> 
    12231223      <scalar name="bcast"> 
    1224         <description>The default broadcast address.</description> 
     1224        <description>The guest's broadcast address.</description> 
     1225      </scalar> 
     1226      <scalar name="lback"> 
     1227        <description>The guest's loopback address.</description> 
    12251228      </scalar> 
    12261229      <scalar name="dev"> 
     
    12651268        <scalar name="ip"> 
    12661269          <description>The IP address which will be assigned to this interface.</description> 
    1267         </scalar> 
    1268         <scalar name="bcast"> 
    1269           <description>The broadcast address.</description> 
    12701270        </scalar> 
    12711271        <scalar name="dev" id="per-if-dev"> 
  • trunk/scripts/chbind

    r2394 r2599  
    3030    echo \ 
    3131$"Usage: $1  [--silent] [--nid <nid>] [--ip <ip_num>[/<mask>]] 
    32              [--bcast <broadcast>] [--] <commands> <args>* 
     32             [--lback <loopback>] [--bcast <broadcast>] 
     33             [--] <commands> <args>* 
    3334 
    3435--silent 
     
    3839--ip <ip_num>[/<mask>] 
    3940    IP address to bind to. 
     41--lback <loopback> 
     42    Loopback address for the network context. 
    4043--bcast <broadcast> 
    4144    Broadcast address for the network context. 
     
    5861} 
    5962 
    60 tmp=$(getopt -o + --long ncap:,nid:,ip:,bcast:,disconnect,flag:,secure,silent,help,version -n "$0" -- "$@") || exit 1 
     63tmp=$(getopt -o + --long ncap:,nid:,ip:,bcast:,lback:,disconnect,flag:,secure,silent,help,version -n "$0" -- "$@") || exit 1 
    6164eval set -- "$tmp" 
    6265 
     
    6871OPT_SILENT= 
    6972OPT_BCAST= 
     73OPT_LBACK= 
    7074OPT_IPS=() 
    7175 
     
    8286        --ip)           OPT_IPS=( "${OPT_IPS[@]}" --ip "$2" ); shift;; 
    8387        --bcast)        OPT_BCAST=$2; shift;; 
     88        --lback)        OPT_LBACK=$2; shift;; 
    8489        --)             shift; break;; 
    8590        *)              echo $"chbind: internal error; arg=='$1'" >&2; exit 1;; 
     
    114119                ${OPT_SILENT:+--silent} 
    115120                ${OPT_BCAST:+--bcast "$OPT_BCAST"} 
     121                ${OPT_LBACK:+--lback "$OPT_LBACK"} 
    116122                "${OPT_IPS[@]}" ) 
    117123 
  • trunk/scripts/chcontext

    r2590 r2599  
    135135done 
    136136 
    137 create_cmd=( ${OPT_CTX:+$_VTAG --create --tag "$OPT_CTX" --silentexist --
     137create_cmd=( ${OPT_CTX:+$_VTAG --create --tag "$OPT_CTX" --silentexist --silent --
    138138             $_VCONTEXT --create --silentexist 
    139139             ${OPT_SILENT:+--silent} 
     
    174174fi 
    175175 
    176 test "$rc" -ne 254 || exec "$_VTAG" --migrate --tag "$OPT_CTX" --
     176test "$rc" -ne 254 || exec "$_VTAG" --migrate --tag "$OPT_CTX" --silent --
    177177                           "${migrate_cmd[@]}" --xid "$OPT_CTX" --migrate -- "$@" 
    178178exit $rc 
  • trunk/scripts/pkgmgmt

    r2518 r2599  
    161161    test -n "$_HAVE_CHBIND_OPTIONS" || _generateChbindOptions "$1" 
    162162     
    163     _mountFilesystemsInternal "$cfgdir"/fstab                                     || return 1 
    164     _mountFilesystemsInternal "$cfgdir"/fstab.local                               || return 1 
    165     _mountFilesystemsInternal "$cfgdir"/fstab.remote $_CHBIND "${CHBIND_OPTS[@]}" || return 1 
     163    _mountFilesystemsInternal "$cfgdir"/fstab                           || return 1 
     164    _mountFilesystemsInternal "$cfgdir"/fstab.local                     || return 1 
     165    _mountFilesystemsInternal "$cfgdir"/fstab.remote "${CHBIND_CMD[@]}" || return 1 
    166166} 
    167167 
     
    178178 
    179179    pushd "$vdir/" >/dev/null || return 1 
    180         _umountVserverInternal  "$cfgdir"/fstab.remote $_CHBIND "${CHBIND_OPTS[@]}" || is_ok= 
    181         _umountVserverInternal  "$cfgdir"/fstab.local                               || is_ok= 
    182         _umountVserverInternal  "$cfgdir"/fstab                                     || is_ok= 
     180        _umountVserverInternal  "$cfgdir"/fstab.remote "${CHBIND_CMD[@]}" || is_ok= 
     181        _umountVserverInternal  "$cfgdir"/fstab.local                     || is_ok= 
     182        _umountVserverInternal  "$cfgdir"/fstab                           || is_ok= 
    183183    popd >/dev/null           || return 1 
    184184     
  • trunk/scripts/vserver-build.fai

    r2352 r2599  
    157157 
    158158cd /mnt 
    159 $_CHBIND "${CHBIND_OPTS[@]}" \ 
     159"${CHBIND_CMD[@]}" \ 
    160160    $_VCONTEXT --create "${OPTS_VCONTEXT_CREATE[@]}" -- \ 
    161161    $_VUNAME --xid self --set -t nodename="${SETUP_HOSTNAME:-fai-build}" \ 
  • trunk/scripts/vserver.functions

    r2593 r2599  
    2121 
    2222declare -a NICE_CMD=() 
    23 declare -a CHBIND_OPTS=() 
     23declare -a CHBIND_CMD=() 
    2424declare -a CAP_OPTS=() 
    2525declare -a CHCONTEXT_INIT_OPTS=() 
     
    9797    local i 
    9898    local bcast= 
     99    local lback= 
    99100    local nid= 
    100101 
    101102    test -n "$_HAVE_INTERFACE_OPTIONS" || _generateInterfaceOptions "$vdir" 
    102103 
    103     local f=$vdir/interfaces/bcast 
     104    local f="$vdir"/interfaces/bcast 
    104105    getFileValue bcast "$f" 
     106    f="$vdir"/interfaces/lback 
     107    getFileValue lback "$f" 
    105108 
    106109    getFileValue nid "$vdir/ncontext" "$vdir/context" 
    107110     
    108     CHBIND_OPTS=( $SILENT_OPT --secure ${nid:+--nid "$nid"} ${bcast:+--bcast "$bcast"} ) 
     111    CHBIND_CMD=( $_CHBIND $SILENT_OPT --secure ${nid:+--nid "$nid"} 
     112                 ${bcast:+--bcast "$bcast"} ${lback:+--lback "$lback"} 
     113                ) 
    109114 
    110115    for i in "${INTERFACES[@]}"; do 
    111         CHBIND_OPTS=( "${CHBIND_OPTS[@]}" --ip "$i" ) 
     116        CHBIND_CMD=( "${CHBIND_CMD[@]}" --ip "$i" ) 
    112117    done 
    113118 
    114     _readFileToArray "$vdir"/nflags        CHBIND_OPTS --flag 
    115     _readFileToArray "$vdir"/ncapabilities CHBIND_OPTS --ncap 
     119    _readFileToArray "$vdir"/nflags        CHBIND_CMD --flag 
     120    _readFileToArray "$vdir"/ncapabilities CHBIND_CMD --ncap 
    116121 
    117122    _HAVE_CHBIND_OPTIONS=1 
     
    837842    _mountVserverInternal "$cfgdir"/fstab 
    838843    _mountVserverInternal "$cfgdir"/fstab.local 
    839     _mountVserverInternal "$cfgdir"/fstab.remote $_CHBIND "${CHBIND_OPTS[@]}" 
     844    _mountVserverInternal "$cfgdir"/fstab.remote "${CHBIND_CMD[@]}" 
    840845 
    841846    isNamespaceCleanup "$cfgdir" && \ 
     
    880885     
    881886    pushd "$vdir/" >/dev/null || return 1 
    882         _umountVserverInternal  "$cfgdir"/fstab.remote $_CHBIND "${CHBIND_OPTS[@]}" || is_ok= 
    883         _umountVserverInternal  "$cfgdir"/fstab.local                               || is_ok= 
    884         _umountVserverInternal  "$cfgdir"/fstab                                     || is_ok= 
     887        _umountVserverInternal  "$cfgdir"/fstab.remote "${CHBIND_CMD[@]}" || is_ok= 
     888        _umountVserverInternal  "$cfgdir"/fstab.local                     || is_ok= 
     889        _umountVserverInternal  "$cfgdir"/fstab                           || is_ok= 
    885890    popd >/dev/null           || return 1 
    886891 
  • trunk/scripts/vserver.start

    r2589 r2599  
    131131if $_VSERVER_INFO - FEATURE migrate; then 
    132132    ${NICE_CMD[@]} \ 
    133     $_CHBIND      "${CHBIND_OPTS[@]}" --
     133    "${CHBIND_CMD[@]}"
    134134    $_EXEC_ULIMIT "$VSERVER_DIR"/ulimits \ 
    135     $_VTAG       --create "${OPTS_VTAG_CREATE[@]}" --
     135    $_VTAG       --create "${OPTS_VTAG_CREATE[@]}" --silent --
    136136    $_VCONTEXT   --create "${OPTS_VCONTEXT_CREATE[@]}" -- \ 
    137137    ${OPTION_STRACE:+$_STRACE -fF -o /tmp/vserver-start.$$} \ 
     
    157157     
    158158    ${NICE_CMD[@]} \ 
    159     $_CHBIND           "${CHBIND_OPTS[@]}" \ 
     159    "${CHBIND_CMD[@]}" \ 
    160160    $_EXEC_ULIMIT      "$VSERVER_DIR/ulimits" \ 
    161161    $_CHCONTEXT_COMPAT "${CHCONTEXT_OPTS[@]}" "${CHCONTEXT_INIT_OPTS[@]}" \ 
  • trunk/scripts/vserver.stop

    r2591 r2599  
    7272elif $_VSERVER_INFO - FEATURE migrate; then 
    7373    "${NICE_CMD[@]}" \ 
    74     "$_CHBIND" "${CHBIND_OPTS[@]}" \ 
    75     "$_VTAG" --migrate "${OPTS_VTAG_MIGRATE[@]}" --
     74    "${CHBIND_CMD[@]}" \ 
     75    "$_VTAG" --migrate "${OPTS_VTAG_MIGRATE[@]}" --silent --
    7676    $_VCONTEXT $SILENT_OPT --migrate --chroot --xid "$S_CONTEXT" -- \ 
    7777    "${INITCMD_STOP[@]}" || fail=1 
  • trunk/scripts/vserver.suexec

    r2589 r2599  
    3535    if test -z "$is_stopped"; then 
    3636        exec \ 
    37         $_CHBIND      "${CHBIND_OPTS[@]}" \ 
     37        "${NICE_CMD[@]}" \ 
     38        "${CHBIND_CMD[@]}" \ 
    3839        $_EXEC_ULIMIT "$VSERVER_DIR/ulimits" \ 
    3940        ${USE_VNAMESPACE:+$_VNAMESPACE --enter "$S_CONTEXT" -- } \ 
    40         $_VTAG --migrate "${OPTS_VTAG_ENTER[@]}" --
     41        $_VTAG --migrate "${OPTS_VTAG_ENTER[@]}" --silent --
    4142        $_VCONTEXT $SILENT_OPT --migrate --chroot \ 
    4243          --xid "$S_CONTEXT" --uid "$user" "${OPTS_VCONTEXT_ENTER[@]}" -- \ 
     
    4445    else 
    4546        exec \ 
    46         $_CHBIND      "${CHBIND_OPTS[@]}" \ 
     47        "${NICE_CMD[@]}" \ 
     48        "${CHBIND_CMD[@]}" \ 
    4749        $_EXEC_ULIMIT "$VSERVER_DIR/ulimits" \ 
    48         $_VTAG --migrate "${OPTS_VTAG_ENTER[@]}" -- \ 
     50        $_VTAG --create "${OPTS_VTAG_CREATE[@]}" --silent -- \ 
    4951        $_VCONTEXT --create "${OPTS_VCONTEXT_CREATE[@]}" -- \ 
    5052        $_VUNAME   --xid self --dir "$VSERVER_DIR"/uts     --missingok -- \ 
     
    5658    exec \ 
    5759    "${NICE_CMD[@]}" \ 
    58     "$_CHBIND"       "${CHBIND_OPTS[@]}" \ 
     60    "${CHBIND_CMD[@]}" \ 
    5961    "$_EXEC_ULIMIT"  "$VSERVER_DIR/ulimits" \ 
    6062    ${USE_VNAMESPACE:+$_VNAMESPACE --enter "$S_CONTEXT" --} \ 
  • trunk/scripts/vsomething

    r2515 r2599  
    108108        else 
    109109            _setVserverDir "$i" 
     110            # subshell so we don't have to clean up 
    110111            ( _generateChbindOptions "$VSERVER_DIR" 
    111               $_VSERVER "$i" status &> /dev/null &&
    112                 CHBIND_CMD=( "$_CHBIND" "${CHBIND_OPTS[@]}" --
     112              $_VSERVER "$i" status &> /dev/null ||
     113                CHBIND_CMD=(
    113114              callInNamespace "$i" \ 
    114115                "$_VNAMESPACE" --new -- \ 
  • trunk/src/vtag.c

    r2589 r2599  
    3939#define CMD_MIGRATE             0x4002 
    4040#define CMD_SILENTEXIST         0x4003 
     41#define CMD_SILENT              0x4004 
    4142 
    4243 
     
    4849  { "create",       no_argument,       0, CMD_CREATE }, 
    4950  { "migrate",      no_argument,       0, CMD_MIGRATE }, 
     51  { "silent",       no_argument,       0, CMD_SILENT }, 
    5052  { "silentexist",  no_argument,       0, CMD_SILENTEXIST }, 
    5153  { 0,0,0,0 }, 
     
    7375            "    --silentexist   ...  be silent when context exists already; useful\n" 
    7476            "                         for '--create' only\n" 
     77            "    --silent        ...  if the feature is not supported, just execute\n" 
     78            "                         <program>\n" 
    7579            "\n" 
    7680            "'vtag --create' exits with code 254 iff the context exists already.\n" 
     
    97101  tag_t                 tag; 
    98102 
    99   if (!vc_isSupported(vcFEATURE_PPTAG)) 
    100     goto exec; 
     103  if (!vc_isSupported(vcFEATURE_PPTAG)) { 
     104    if (args->verbosity >= 1) { 
     105      errno = ENOSYS; 
     106      perror(ENSC_WRAPPERS_PREFIX); 
     107      return wrapper_exit_code; 
     108    } 
     109    else 
     110      goto exec; 
     111  } 
    101112 
    102113  if (args->do_create) { 
     
    140151    int         c = getopt_long(argc, argv, "+", CMDLINE_OPTIONS, 0); 
    141152    if (c==-1) break; 
    142      
     153 
    143154    switch (c) { 
    144155      case CMD_HELP             :  showHelp(1, argv[0], 0); 
     
    148159      case CMD_SILENTEXIST      :  args.is_silentexist = true;   break; 
    149160      case CMD_TAG              :  args.tag = Evc_tagopt2tag(optarg,true); break; 
     161      case CMD_SILENT           :  args.verbosity--;             break; 
    150162 
    151163      default           :