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

2014-12-18 Thread Ruben S. Montero
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 himbe...@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@lists.opennebula.org
 http://lists.opennebula.org/listinfo.cgi/users-opennebula.org

___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


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

2014-12-18 Thread Thomas Stein
Am 18.12.14 09:57, schrieb Ruben S. Montero:
 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).

Sounds reasonable. I will look into it. Thanks.

cheers
t.

 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 himbe...@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@lists.opennebula.org
 http://lists.opennebula.org/listinfo.cgi/users-opennebula.org

 

___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org