#!/bin/sh . "${PM_FUNCTIONS}" get_running_netvms() { # Actually get running VMs with PCI devices attached RUNNING_VMS=`xm list --state=Running | tail -n +3 | cut -f 1 -d " "` RUNNING_NETVMS="" for VM in $RUNNING_VMS; do if [ -n "`xm pci-list $VM`" ]; then echo "$VM" fi done } suspend_net() { for VM in `get_running_netvms`; do qvm-run -u root --pass_io $VM "service NetworkManager stop" done # Ignore exit status from netvm... return 0 } resume_net() { for VM in `get_running_netvms`; do qvm-run -u root --pass_io $VM "service NetworkManager start" done # Ignore exit status from netvm... return 0 } case "$1" in resume) resume_net ;; suspend) suspend_net ;; *) exit 0 ;; esac