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

[Xen-users] scripts



I wonder if there is a way to for xen to run Âscript after guess is shutdown.
I would like to pass sound card from linux to hvm guess and then when hvm guest is shutdown back to linux. ÂScript can unload all usb modules and assign to hvm and back.
#!/bin/bash

if [ $# -ne 2 ]; then
  echo "Require PCI devices in format: Â<domain>:<bus>:<slot>.<function>"
  echo "Eg: $(basename $0) device_name 0000:00:1b.0"
  exit 1
fi
devicename=$1
pcidev=$2

for pcidev in $@; do
  if [ -h /sys/bus/pci/devices/"$pcidev"/driver ]; then
    echo "Unbinding $pcidev from" $(basename $(readlink /sys/bus/pci/devices/"$pcidev"/driver))
    echo -n "$pcidev" > /sys/bus/pci/devices/"$pcidev"/driver/unbind
  fi
  echo "Binding $pcidev to $devicename"
  echo -n "$pcidev" > /sys/bus/pci/drivers/$devicename/bind
  echo -n "$pcidev" > /sys/bus/pci/drivers/$devicename/new_slot
done

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxx
http://lists.xen.org/xen-users

 


Rackspace

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