Xen 4.0.1 vifname gone from config file

networkingxen

Playing around with xen 4.0.1, trying to setup a simple domU.

When I put the parameter in vif like :

vif = [ 'ip=192.168.1.41,mac=00:16:3E:2F:F4:78,bridge=xenbr0,vifname=domu1' ]

It fails

error: Device 0 (vif) could not be connected. 
ip link set vif5.0 name domu1 failed

Also, running the command from dom0:

ip link set vif5.0 name domu1

returns

RTNETLINK answers: Device or resource busy

Any idea ?

Best Answer

From what I can tell the vifname= command isn't properly supported in many versions of Xen.

My guess is that you can only rename the device before certain usage and the Xen vif scripts are doing it too late.

Looking at the source in vif-common.sh:

vifname=$(xenstore_read_default "$XENBUS_PATH/vifname" "")
if [ "$vifname" ]
then
  if [ "$command" == "online" ] && ! ip link show "$vifname" >&/dev/null
  then
    do_or_die ip link set "$vif" name "$vifname"
  fi
  vif="$vifname"
fi

I don't see any obvious bugs. You should look at your vif-common.sh and confirm that it is the same as this.

Edit: I think maybe the vifX.Y interface may not be up at this point. Try commenting out the do_or_die line. That should set vif="$vifname" and if the device is then created later there is no reason to rename it.