X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-remote.git/blobdiff_plain/ccdd1009d00397d0f81fa9a95aa96faf448b9e94..868d7196d06847220363f13b541acf0bc80086fa:/host/usr/sbin/invirt-vmcontrol diff --git a/host/usr/sbin/invirt-vmcontrol b/host/usr/sbin/invirt-vmcontrol index 70bff12..dff84c3 100755 --- a/host/usr/sbin/invirt-vmcontrol +++ b/host/usr/sbin/invirt-vmcontrol @@ -22,6 +22,9 @@ case "$ACTION" in ;; install|create) shift; shift; + if [ -f "/etc/invirt/nocreate" ]; then + echo "Host $HOSTNAME is currently refusing VM creation." && exit 2 + fi xm list "$MACHINE" >/dev/null 2>/dev/null && echo "$MACHINE already exists" && exit 1 if [ "$ACTION" = "install" ]; then xm create invirt-database machine_name="$ORIGMACHINE" installer_options="$(printf '%q ' "$@")" @@ -38,6 +41,22 @@ case "$ACTION" in vnctoken) invirt-vnc-authtoken "$ORIGMACHINE" ;; + arp) + iface=`invirt-getconf xen.iface` + xs_prefix="/local/domain/0/backend/vif" + domid=`xm domid $MACHINE` + for vif in `xenstore-list $xs_prefix/$domid`; do + ip=`xenstore-read $xs_prefix/$domid/$vif/ip` + script=`xenstore-read $xs_prefix/$domid/$vif/script` + gw=`echo $script | sed -ne 's/.* gateway=\([0-9\.]*\).*/\1/p'` + oip=`echo $script | sed -ne 's/.* other_ip=\([0-9\.]*\).*/\1/p'` + ogw=`echo $script | sed -ne 's/.* other_gateway=\([0-9\.]*\).*/\1/p'` + timeout -s KILL 5 /usr/sbin/arpspoof -i $iface -t $gw $ip + if [ -n "$oip" ]; then + timeout -s KILL 5 /usr/sbin/arpspoof -i $iface -t $ogw $oip + fi + done + ;; *) echo "ERROR: Invalid Command" exit 34