I have a script that dynamically adds and removes virtual NICS. E.g. it runs define nic, couples it to a vswitch, sets it online, connects somewhere, sets it offline, ungroups and detaches it. The problem I have is that I cannot figure out how to tell that the device is really offline and the NIC is safe to detach. I have looked at the s390 kernel drivers, namely into drivers/s390/cio/device.c and there I see that during offline processing (ccw_device_set_offline), the ccw_device online field is set to 0 first and then there is a wait loop that finishes the offline process. The reason I'm mentioning the ccw_device online filed is that it is what is being read when you read /sys/bus/ccw/devices/<bus_id>/online from user mode.
If the device is detached before the offline processing is finished, you will get this error message in syslog: <Device bus-ID>: The device stopped operating while being set offline I found a reference for this message here: http://pic.dhe.ibm.com/infocenter/lnxinfo/v3r0m0/index.jsp?topic=%2Fcom.ibm.linux.l0kmsg.doc%2Fl0km_m_cio.390dcf.html Which says "The device is now inactive, but setting it online again might fail." Which describes the problem I'm seeing ;-) Can anyone think of a way how to tell that the device is really offline (i.e. in DEV_STATE_DISCONNECTED or DEV_STATE_OFFLINE) so that it is safe to detach? And do this from user mode? My current solution is simply to put a short sleep before the CP detach command but that does not seem to be very safe even though I have not been able to reproduce the failure with it. Thanks, Tomas Tomas Pavelka CA Technologies Sr Software Engineer Tel: +420226207796 tomas.pave...@ca.com <mailto:tomas.pave...@ca.com>[cid:image001.gif@01CF6387.B70E3490]<http://www.ca.com/> ---------------------------------------------------------------------- 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/