Not encouraging to make procedures dependent on vswitch names,
just sharing info on how to obtain base info within Linux itself.
On 01/19/2011 09:02 PM, Christian Paro wrote:
#!/bin/bash
### BEGIN SCRIPT: getswitchname ###
function getVSwitch {
local iface=$1
local userid=$(vmcp q userid)
# grep "^VM.*Name:" /proc/sysinfo
VM00 Name: LNXUSR1
might save a hypercall by not using vmcp
local vdev=$(sed -rn
's/^SUBSYSTEM.*KERNELS=="0.0.([0-9a-f]{4})",.*NAME="'${iface}'"$/\1/pI' \
/etc/udev/rules.d/70-persistent-net.rules)
This file might have been edited by an administrator meanwhile and no
longer reflect the actual system configuration. You can get the latter
directly from sysfs to obtain the mapping between network interface name
and device bus IDs (devnos) on s390:
local vdev=$(readlink -f /sys/class/net/eth0/device)
vdev=${vdev##*.}
Based on:
# ll /sys/class/net/eth0/device
lrwxrwxrwx. 1 root root 0 Jan 20 18:33 /sys/class/net/eth0/device ->
../../../0.0.f5f0
catdirectoryentry --mergeprofile ${userid%% *} | sed -n
's/^NICDEF\s'${vdev}'.*SYSTEM //p'
}
getVSwitch $1
...where `catdirectoryentry` is a script I wrote for a project I'm current
working on, which pulls the directory entry for a guest, expands all
Steffen
Linux on System z Development
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/