Revision 8ba80517 common.sh

b/common.sh
362 362

  
363 363
}
364 364

  
365
get_instance_info () {
366

  
367
  if [ -z "$GANETI_INSTANCE_NAME" -a -n "$INSTANCE" ]; then
368
    GANETI_INSTANCE_NAME=$INSTANCE
369
  fi
370

  
371
}
372

  
373
get_mode_info () {
374

  
375
  local iface=$1
376
  local mode=$2
377
  local link=$3
378

  
379
  TABLE=
380
  INDEV=
381

  
382
  if [ "$mode" = "routed" ]; then
383
    TABLE=$link
384
    INDEV=$iface
385
  elif [ "$mode" = "bridged" ]; then
386
    INDEV=$link
387
  fi
388

  
389
}
390

  
365 391

  
366 392
# Use environment variables to calculate desired info
367 393
# IP, MAC, LINK, TABLE, BRIDGE,
......
369 395
function get_info {
370 396

  
371 397
  $SNF_NETWORK_LOG $0 "Getting info for $INTERFACE of $GANETI_INSTANCE_NAME"
398
  get_instance_info
399
  get_mode_info $INTERFACE $MODE $LINK
372 400
  get_ebtables_chains $INTERFACE
373 401
  get_rev4_info $IP
374 402
  get_eui64 $MAC $NETWORK_SUBNET6

Also available in: Unified diff