[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] XCP, openvswitch and windows guests, not working - hackish workaround


  • To: xen-api@xxxxxxxxxxxxx
  • From: Oskar Johansson <onkelborg@xxxxxxxxxxxxx>
  • Date: Fri, 14 Sep 2012 11:33:35 +0200 (CEST)
  • Delivery-date: Fri, 14 Sep 2012 14:30:49 +0000
  • List-id: User and development list for XCP and XAPI <xen-api.lists.xen.org>

Hi

I've been struggling with XCP and openvswitch to get it to work with windows 
guests. I've finally managed to get it working (I think), I've been able to 
boot a windows 2008 guest with a network interface, and been able to add and 
remove interfaces when windows is running, and it's all working as it should as 
far as I can see (I've got network connectivity, dhcp is working etc.) 
XenCenter works as it should etc.

I'm running Ubuntu 12.04 64-bit, and latest unstable xcp

This is a link to my blog with some details (the blog is in swedish, but I've 
written this post in english)

http://blog.onkelborg.com/2012/09/xcp-openvswitch-and-windows-guests-workaround

I've edited two files, and it's really hackish, however, it's maybe something 
to work with anyway, at least it's a temporary solution.

The theory is that the vif-interface goes online, then offline, and then online 
again. My first attempt was to write a temp-file, and delay the deletion of 
that file a few seconds in the background. A call to offline will then simply 
exit if that file existed. However, that didn't solve bootup since the 
interface might go online way before pv-drivers are initialized (and the 
interface goes offline, and then online again. The offline-part will bluescreen 
the boot.) My second attempt was (and is) to delay the execution of the actual 
delete a few seconds allowing the interface to go online again. If it goes 
online again then the whole deletion is aborted.

First /etc/xen/scripts/qemu-ifup:

>>>
#!/bin/sh

echo -c 'config qemu network with xen bridge for '
echo $*

ifconfig $1 0.0.0.0 up
#brctl addif $2 $1
ovs-vsctl add-port $2 $1
<<<

Then /usr/lib/xcp/scripts/vif
I've replaced the whole case-switch (case "${ACTION}" in) and beneath with this:
>>>
ONOFFBUGDIR=/run/xcponoffbug
ONOFFDEVFILE=${ONOFFBUGDIR}/vif${DOMID}.${DEVID}.tmp

mkdir -p ${ONOFFBUGDIR}

delonoffdevfile() {
  sleep 6
  rm ${ONOFFDEVFILE} || true
}

delvif() {
  if [ -e ${ONOFFDEVFILE} ] ; then
    echo "Ignore remove/offline"
#    rm ${ONOFFDEVFILE} || true
    exit
  fi
  sleep 1
  if [ -e ${ONOFFDEVFILE} ] ; then
    echo "Ignore remove/offline"
#    rm ${ONOFFDEVFILE} || true
    exit
  fi
  sleep 1
  if [ -e ${ONOFFDEVFILE} ] ; then
    echo "Ignore remove/offline"
#    rm ${ONOFFDEVFILE} || true
    exit
  fi
  sleep 1
  if [ -e ${ONOFFDEVFILE} ] ; then
    echo "Ignore remove/offline"
#    rm ${ONOFFDEVFILE} || true
    exit
  fi
  sleep 1
  if [ -e ${ONOFFDEVFILE} ] ; then
    echo "Ignore remove/offline"
#    rm ${ONOFFDEVFILE} || true
    exit
  fi
  sleep 1
  if [ -e ${ONOFFDEVFILE} ] ; then
    echo "Ignore remove/offline"
#    rm ${ONOFFDEVFILE} || true
    exit
  fi
  sleep 1
  if [ -e ${ONOFFDEVFILE} ] ; then
    echo "Ignore remove/offline"
#    rm ${ONOFFDEVFILE} || true
    exit
  fi
  sleep 1
  if [ -e ${ONOFFDEVFILE} ] ; then
    echo "Ignore remove/offline"
#    rm ${ONOFFDEVFILE} || true
    exit
  fi
  sleep 1
  if [ -e ${ONOFFDEVFILE} ] ; then
    echo "Ignore remove/offline"
#    rm ${ONOFFDEVFILE} || true
    exit
  fi
  call_hook_script $DOMID "${ACTION}"
                # Unclear whether this is necessary, since netback also does it:
  logger -t script-vif "${dev}: removing ${HOTPLUG_STATUS}"
  xenstore-rm "${HOTPLUG_STATUS}"
  logger -t script-vif "${dev}: removing ${HOTPLUG}/hotplug"
                # Trigger xapi to clean up:
  xenstore-rm "${HOTPLUG}/hotplug"
  logger -t scripts-vif "${dev} has been removed"
  remove_from_bridge
}

case "${ACTION}" in
online)
    touch ${ONOFFDEVFILE} || true
#    sleep 3
    if [ -e ${ONOFFDEVFILE} ] ; then
      echo "Ignore online"
    else
      exit
    fi
    delonoffdevfile &
    if [ "${TYPE}" = "vif" ] ; then
        handle_ethtool rx
        handle_ethtool tx
        handle_ethtool sg
        handle_ethtool tso
        handle_ethtool ufo
        handle_ethtool gso

        handle_mtu
        add_to_bridge
        handle_promiscuous

        # only for the benefit of xenrt test case, see CA-61528
        xenstore-write "${HOTPLUG}/vif" "${dev}"
        xenstore-write "${HOTPLUG}/hotplug" "online"

        logger -t script-vif "${dev}: writing ${HOTPLUG_STATUS}=connected"
        xenstore-write "${HOTPLUG_STATUS}" "connected"
        call_hook_script $DOMID "${ACTION}"
    fi
    ;;

add)
    touch ${ONOFFDEVFILE} || true
#    sleep 3
    if [ -e ${ONOFFDEVFILE} ] ; then
      echo "Ignore add"
    else
      exit
    fi
    delonoffdevfile &
    if [ "${TYPE}" = "tap" ] ; then
        add_to_bridge
    fi
    ;;

remove|offline)
#    exit
    if [ -e ${ONOFFDEVFILE} ] ; then
      echo "Ignore remove/offline"
#      rm ${ONOFFDEVFILE} || true
      exit
    fi
    if [ "${TYPE}" = "vif" ] ;then
      delvif &
    fi
    ;;

move)
    touch ${ONOFFDEVFILE} || true
#    sleep 3
    if [ -e ${ONOFFDEVFILE} ] ; then
      echo "Ignore move"
    else
      exit
    fi
    delonoffdevfile &
    if [ "${TYPE}" = "vif" ] ;then
        add_to_bridge
    fi
esac
<<<

/Mvh
Oskar Johansson, Onkelborg
onkelborg@xxxxxxxxxxxxx
073-0 985 985
Gottne 206
895 95 Mellansel



_______________________________________________
Xen-api mailing list
Xen-api@xxxxxxxxxxxxx
http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.