You can get the information you need indirectly, at least.

The udev configuration in /etc/udev/rules.d records the correlation between
virtual device numbers (line "0600") and Linux network interface names (like
"eth0"), and the virtual device number corresponding to your network
interface can be used to look up the vswitch (if any) that your interface is
on.

This is a slight oversimplification (since older systems have things set up
a little differently in the udev configuarion), but...

#!/bin/bash
### BEGIN SCRIPT: getswitchname ###
function getVSwitch {
  local iface=$1
  local userid=$(vmcp q userid)
  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)
  catdirectoryentry --mergeprofile ${userid%% *} | sed -n
's/^NICDEF\s'${vdev}'.*SYSTEM //p'
}

getVSwitch $1

### END OF SCRIPT ###

...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
keywords, collapses all white space, and optionally does an intelligent
merge of its profile contents. You'll have to find or write something
similar to substitute into that step.

Running the above `getswitchname` script with the argument of "eth0", for
example, prints "VSW1" out to the command line. Running it for "eth1" prints
out "VSW2", in accordance with the names of the virtual switches underlying
these two respective interfaces.

- Chris

On Wed, Jan 19, 2011 at 9:50 AM, Alan Altmark <alan_altm...@us.ibm.com>wrote:

> On Wednesday, 01/19/2011 at 09:41 EST, PHILIP TULLY
> <tull...@optonline.net> wrote:
> > I was looking for a place within Linux that the vswitch name is stored
> > for each virtual nic.
> >
> > I can query the nic information.
> > # vmcp q v nic
> > Adapter 0350.P00 Type: QDIO      Name: osatest     Devices: 3
> > MAC: 02-00-06-00-00-C5         VSWITCH: SYSTEM ESNET1
> >
> > If you look at the data in this list, all of it is stored under
> > /sys/bus/ccwgroup/drivers/qeth
> > the only info I can't find is the vswitch name.
> >
> > Does anyone know if it is stored with linux?
>
> Phil, why would you want Linux to have that info?  You really don't want
> to (IMO) build operational dependencies on VSWITCH names.  I have one
> called DEVQA that has access to a Development VLAN and a QA VLAN.  If I
> add a management VLAN to it, I'm going to change the VSWITCH name to
> DEVQAMGTto reflect that, but I don't want the Linux guests to care. That's
> something that I manage at the z/VM level.
>
> That other stuff is architecturally part of the OSA and Linux is entitled
> to know it.  Imagine a world where the virtual machine has only enough
> authority to get Linux booted up and running, and its device drivers
> operational.  No other DIAGNOSE functions or CP commands allowed.   From a
> security point of view, very similar to LPAR.  Ah, Paradise!   (Oh,
> waiter!  The umbrella in my glass fell out.  Please bring me a fresh
> drink.)
>
> Alan Altmark
>
> z/VM and Linux on System z Consultant
> IBM System Lab Services and Training
> ibm.com/systems/services/labservices
> office: 607.429.3323
> alan_altm...@us.ibm.com
> IBM Endicott
>
> ----------------------------------------------------------------------
> For LINUX-390 subscribe / signoff / archive access instructions,
> send email to lists...@vm.marist.edu 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/
>

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu 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/

Reply via email to