#! /bin/bash

PATH=/etc/xen/scripts:$PATH

. /etc/xen/scripts/locking.sh

claim_lock xenbus_hotplug_global

case "$XENBUS_TYPE" in
  tap)
    /etc/xen/scripts/blktap "$ACTION"
    ;;
  vbd)
    /etc/xen/scripts/block "$ACTION"
    ;;
  vtpm)
    /etc/xen/scripts/vtpm "$ACTION"
    ;;
  vif)
    [ -n "$script" ] && $script "$ACTION"
    ;;
  vscsi)
    /etc/xen/scripts/vscsi "$ACTION"
    ;;
esac

case "$ACTION" in
  add)
    ;;
  remove)
    /etc/xen/scripts/xen-hotplug-cleanup
    ;;
  online)
    ;;
  offline)
    ;;
esac

release_lock xenbus_hotplug_global
