[one-users] one and hooks for networks on hardware nodes

Thomas Stein himbeere at meine-oma.de
Thu Dec 18 00:25:35 PST 2014


Hello.

Usually i configure my networks for virtual machines with hook files
located in /etc/libvirt/hooks. For example this one:

#!/bin/bash

guest_name=some_name
guest_ipaddr=123.123.123.123
if [ "${1}" = "${guest_name}" ]; then
   if [ "${2}" = "stopped" -o "${2}" = "reconnect" ]; then
                ip route del 123.123.123.123 via 192.0.0.1 dev virbr1
                ip neigh del proxy 123.123.123.123 dev eth0
                sleep ${RANDOM:0:1}.${RANDOM:-1:1}
                iptables -D FORWARD -i eth0 -o virbr1 -s 0.0.0.0/0 -d
123.123.123.123/32 -j ACCEPT
                iptables -D FORWARD -i virbr1 -o eth0 -s
123.123.123.123/32 -d 0.0.0.0/0 -j ACCEPT
   fi
   if [ "${2}" = "start" -o "${2}" = "reconnect" ]; then
                ip route add 123.123.123.123 via 192.0.0.1 dev virbr1
                ip neigh add proxy 123.123.123.123 dev eth0
                sleep ${RANDOM:0:1}.${RANDOM:-1:1}
                iptables -I FORWARD 4 -i eth0 -o virbr1 -s 0.0.0.0/0 -d
123.123.123.123/32 -j ACCEPT
                iptables -I FORWARD 4 -i virbr1 -o eth0 -s
123.123.123.123/32 -d 0.0.0.0/0 -j ACCEPT
   fi
fi

How would i accomplish this whit opennebula hooks? Can i even set the
$guest_name? It's always like one-$number i guess. Okay, there is for
sure another way of setting this up. Is there?

thanks and best regards
t.


More information about the Users mailing list