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

Ruben S. Montero rsmontero at opennebula.org
Thu Dec 18 00:57:09 PST 2014


This could be done with a oned VM hook as they could be executed in the
target host.

However, I think it should be better to extend one of the existing network
drivers. There you can tune the pre (before booting the VM) post
(after booting the VM) and clean (after deleteing the VM from the host).
Those are also used in migrations and stop/resume, attach/detach NICs....
More information [1]. As I said you probably can hook on one of the
existing drivers and add your code afterwards...

About the VM name, it MUST be one-<ID>, that cannot be changed. There are
other drivers that may relay on that naming convention. Also one-<ID> is
unique across your cloud.

Cheers

Ruben


[1]
http://docs.opennebula.org/4.10/integration/infrastructure_integration/devel-nm.html





On Thu Dec 18 2014 at 9:25:37 AM Thomas Stein <himbeere at meine-oma.de> wrote:

> 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.
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20141218/2a710265/attachment-0001.htm>


More information about the Users mailing list