Re: [one-users] wrong gateway detected by vm-context

2015-02-17 Thread Javier Fontan
We should probably take out the code that generates the gateway as it only
gives problems:

https://github.com/OpenNebula/addon-context-linux/blob/master/base_rpm/etc/one-context.d/00-network#L68-L73

Concerning the GATEWAY_INTERFACE, this variable contains a number or the
ETH that appears in the context file. In fact it is not the name of
the interface as with the new naming scheme it can be called with a
different name, for example en3p8.

http://en.wikipedia.org/wiki/Consistent_Network_Device_Naming

Cheers

On Fri Feb 13 2015 at 1:49:42 PM Madko  wrote:

> I have found the solution. GATEWAY_IFACE must be set, but in upper case. I
> don't know why. Any idea? If I put GATEWAY_IFACE=eth1 (eth1 is the real
> name) it doesn't work, but GATEWAY_IFACE=ETH1 works...
>
> Le Fri Feb 13 2015 at 10:03:33, Madko  a écrit :
>
> Hi,
>>
>> It seems vmcontext scripts try to guess the gateway IP as soon as any
>> interface has a gateway set.
>>
>> Here is my case:
>> one vm with eth0 to internal admin network, and eth1 to wan. Only eth1
>> has a gateway set.
>> When init script vmcontext start, it found out that there is a gateway
>> (but on eth1), and so is_gateway function on eth0 seems to returns true.
>> After that the gateway is guessed with NETWORK_ADDRESS.1 but I don't know
>> why?
>>
>> here is my context:
>> ETH0_IP='192.168.199.109'
>> ETH0_MAC='02:00:c0:a8:c7:6d'
>> ETH1_DNS='10.156.255.245'
>> ETH1_GATEWAY='10.156.0.1'
>> ETH1_IP='10.156.24.93'
>> ETH1_MAC='02:00:0a:9c:18:5d'
>> ETH1_MASK='255.255.224.0'
>> ETH1_NETWORK='10.156.0.0'
>>
>> Here is the ifcfg-eth0 written by vmcontext init script:
>> DEVICE=eth0
>> BOOTPROTO=none
>> ONBOOT=yes
>> TYPE=Ethernet
>> NETMASK=255.255.255.0
>> IPADDR=192.168.199.109
>> GATEWAY=192.168.199.1
>>
>> ifcfg-eth1 is good and has its gateway correctly set.
>>
>> Here is my vnet template where no gateway is set (same problem if I
>> remove the empty GATEWAY key):
>> VIRTUAL NETWORK TEMPLATE
>>
>> BRIDGE="br0"
>> DESCRIPTION="réseau admin vm"
>> GATEWAY=""
>> PHYDEV=""
>> ROLE="admin"
>> VLAN="YES"
>> VLAN_ID="199"
>>
>> is it a bug?
>>
>> Attached here is the vmcontext network script log
>>
>> best regards,
>>
>> Edouard
>>
> ___
> 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] wrong gateway detected by vm-context

2015-02-13 Thread Madko
I have found the solution. GATEWAY_IFACE must be set, but in upper case. I
don't know why. Any idea? If I put GATEWAY_IFACE=eth1 (eth1 is the real
name) it doesn't work, but GATEWAY_IFACE=ETH1 works...

Le Fri Feb 13 2015 at 10:03:33, Madko  a écrit :

> Hi,
>
> It seems vmcontext scripts try to guess the gateway IP as soon as any
> interface has a gateway set.
>
> Here is my case:
> one vm with eth0 to internal admin network, and eth1 to wan. Only eth1 has
> a gateway set.
> When init script vmcontext start, it found out that there is a gateway
> (but on eth1), and so is_gateway function on eth0 seems to returns true.
> After that the gateway is guessed with NETWORK_ADDRESS.1 but I don't know
> why?
>
> here is my context:
> ETH0_IP='192.168.199.109'
> ETH0_MAC='02:00:c0:a8:c7:6d'
> ETH1_DNS='10.156.255.245'
> ETH1_GATEWAY='10.156.0.1'
> ETH1_IP='10.156.24.93'
> ETH1_MAC='02:00:0a:9c:18:5d'
> ETH1_MASK='255.255.224.0'
> ETH1_NETWORK='10.156.0.0'
>
> Here is the ifcfg-eth0 written by vmcontext init script:
> DEVICE=eth0
> BOOTPROTO=none
> ONBOOT=yes
> TYPE=Ethernet
> NETMASK=255.255.255.0
> IPADDR=192.168.199.109
> GATEWAY=192.168.199.1
>
> ifcfg-eth1 is good and has its gateway correctly set.
>
> Here is my vnet template where no gateway is set (same problem if I remove
> the empty GATEWAY key):
> VIRTUAL NETWORK TEMPLATE
>
> BRIDGE="br0"
> DESCRIPTION="réseau admin vm"
> GATEWAY=""
> PHYDEV=""
> ROLE="admin"
> VLAN="YES"
> VLAN_ID="199"
>
> is it a bug?
>
> Attached here is the vmcontext network script log
>
> best regards,
>
> Edouard
>
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


[one-users] wrong gateway detected by vm-context

2015-02-13 Thread Madko
Hi,

It seems vmcontext scripts try to guess the gateway IP as soon as any
interface has a gateway set.

Here is my case:
one vm with eth0 to internal admin network, and eth1 to wan. Only eth1 has
a gateway set.
When init script vmcontext start, it found out that there is a gateway (but
on eth1), and so is_gateway function on eth0 seems to returns true. After
that the gateway is guessed with NETWORK_ADDRESS.1 but I don't know why?

here is my context:
ETH0_IP='192.168.199.109'
ETH0_MAC='02:00:c0:a8:c7:6d'
ETH1_DNS='10.156.255.245'
ETH1_GATEWAY='10.156.0.1'
ETH1_IP='10.156.24.93'
ETH1_MAC='02:00:0a:9c:18:5d'
ETH1_MASK='255.255.224.0'
ETH1_NETWORK='10.156.0.0'

Here is the ifcfg-eth0 written by vmcontext init script:
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
NETMASK=255.255.255.0
IPADDR=192.168.199.109
GATEWAY=192.168.199.1

ifcfg-eth1 is good and has its gateway correctly set.

Here is my vnet template where no gateway is set (same problem if I remove
the empty GATEWAY key):
VIRTUAL NETWORK TEMPLATE

BRIDGE="br0"
DESCRIPTION="réseau admin vm"
GATEWAY=""
PHYDEV=""
ROLE="admin"
VLAN="YES"
VLAN_ID="199"

is it a bug?

Attached here is the vmcontext network script log

best regards,

Edouard
+ configure_network
+ gen_network_configuration
++ get_interface_mac
++ awk '/^[0-9]+: [[:alnum:]]+:/ { device=$2; gsub(/:/, "",device)} /link\/ether/ { print device " " $2 }'
++ ip link show
+ INTERFACE_MAC='eth0 02:00:c0:a8:c7:6d
eth1 02:00:0a:9c:18:5d'
++ get_context_interfaces
++ grep -E '^ETH[0-9]+_MAC='
++ sed 's/_.*$//'
++ sort
++ env
+ CONTEXT_INTERFACES='ETH0
ETH1'
++ echo ''
++ sed 's/^ETH//'
+ GATEWAY_IFACE_NUM=
+ for interface in '$CONTEXT_INTERFACES'
+ UPCASE_DEV=ETH0
++ get_iface_var MAC
++ var_name=ETH0_MAC
+++ eval 'echo "${ETH0_MAC}"'
 echo 02:00:c0:a8:c7:6d
++ var=02:00:c0:a8:c7:6d
++ echo 02:00:c0:a8:c7:6d
+ MAC=02:00:c0:a8:c7:6d
++ get_dev 'eth0 02:00:c0:a8:c7:6d
eth1 02:00:0a:9c:18:5d' 02:00:c0:a8:c7:6d
++ list='eth0 02:00:c0:a8:c7:6d
eth1 02:00:0a:9c:18:5d'
++ mac=02:00:c0:a8:c7:6d
++ echo 'eth0 02:00:c0:a8:c7:6d
eth1 02:00:0a:9c:18:5d'
++ grep 02:00:c0:a8:c7:6d
++ cut '-d ' -f1
++ tail -n1
+ DEV=eth0
++ echo ETH0
++ sed 's/^ETH//'
+ IFACE_NUM=0
++ get_ip
+++ get_iface_var IP
+++ var_name=ETH0_IP
 eval 'echo "${ETH0_IP}"'
+ echo 192.168.199.109
+++ var=192.168.199.109
+++ echo 192.168.199.109
++ ip=192.168.199.109
++ '[' -z 192.168.199.109 ']'
++ echo 192.168.199.109
+ IP=192.168.199.109
++ get_network
+++ get_iface_var NETWORK
+++ var_name=ETH0_NETWORK
 eval 'echo "${ETH0_NETWORK}"'
+ echo ''
+++ var=
+++ echo
++ network=
++ '[' -z '' ']'
+++ echo 192.168.199.109
+++ cut -d. -f1,2,3
++ network=192.168.199.0
++ echo 192.168.199.0
+ NETWORK=192.168.199.0
++ get_mask
+++ get_iface_var MASK
+++ var_name=ETH0_MASK
 eval 'echo "${ETH0_MASK}"'
+ echo ''
+++ var=
+++ echo
++ mask=
++ '[' -z '' ']'
++ mask=255.255.255.0
++ echo 255.255.255.0
+ MASK=255.255.255.0
++ get_gateway
++ is_gateway
++ '[' -z '' ']'
++ true
+++ get_iface_var GATEWAY
+++ var_name=ETH0_GATEWAY
 eval 'echo "${ETH0_GATEWAY}"'
+ echo ''
+++ var=
+++ echo
++ gateway=
++ '[' -z '' ']'
++ '[' eth0 = eth0 ']'
+++ echo 192.168.199.0
+++ cut -d. -f1,2,3
++ net_prefix=192.168.199
++ gateway=192.168.199.1
++ echo 192.168.199.1
+ GATEWAY=192.168.199.1
++ get_iface_var IPV6
++ var_name=ETH0_IPV6
+++ eval 'echo "${ETH0_IPV6}"'
 echo ''
++ var=
++ echo
+ IPV6=
+ [[ -z '' ]]
++ get_iface_var IP6
++ var_name=ETH0_IP6
+++ eval 'echo "${ETH0_IP6}"'
 echo ''
++ var=
++ echo
+ IPV6=
++ get_gateway6
++ is_gateway
++ '[' -z '' ']'
++ true
++ get_iface_var GATEWAY6
++ var_name=ETH0_GATEWAY6
+++ eval 'echo "${ETH0_GATEWAY6}"'
 echo ''
++ var=
++ echo
+ GATEWAY6=
++ get_iface_var CONTEXT_FORCE_IPV4
++ var_name=ETH0_CONTEXT_FORCE_IPV4
+++ eval 'echo "${ETH0_CONTEXT_FORCE_IPV4}"'
 echo ''
++ var=
++ echo
+ CONTEXT_FORCE_IPV4=
+ cat
+ [[ -z '' ]]
+ gen_iface_conf
+ cat
+ '[' -n 192.168.199.1 ']'
+ echo GATEWAY=192.168.199.1
+ echo ''
+ [[ -n '' ]]
+ ifup eth0
+ for interface in '$CONTEXT_INTERFACES'
+ UPCASE_DEV=ETH1
++ get_iface_var MAC
++ var_name=ETH1_MAC
+++ eval 'echo "${ETH1_MAC}"'
 echo 02:00:0a:9c:18:5d
++ var=02:00:0a:9c:18:5d
++ echo 02:00:0a:9c:18:5d
+ MAC=02:00:0a:9c:18:5d
++ get_dev 'eth0 02:00:c0:a8:c7:6d
eth1 02:00:0a:9c:18:5d' 02:00:0a:9c:18:5d
++ list='eth0 02:00:c0:a8:c7:6d
eth1 02:00:0a:9c:18:5d'
++ mac=02:00:0a:9c:18:5d
++ grep 02:00:0a:9c:18:5d
++ cut '-d ' -f1
++ tail -n1
++ echo 'eth0 02:00:c0:a8:c7:6d
eth1 02:00:0a:9c:18:5d'
+ DEV=eth1
++ sed 's/^ETH//'
++ echo ETH1
+ IFACE_NUM=1
++ get_ip
+++ get_iface_var IP
+++ var_name=ETH1_IP
 eval 'echo "${ETH1_IP}"'
+ echo 10.156.24.93
+++ var=10.156.24.93
+++ echo 10.156.24.93
++ ip=10.156.24.93
++ '[' -z 10.156.24.93 ']'
++ echo 10.156.24.93
+ IP=10.156.24.93
++ get_network
+++ get_iface_var NETWORK
+++ var_name=ETH1_NETWORK
 eval 'echo "${ETH1_NETWORK}"'
+ echo 10.156.0.0
+++ var=10.156.0.0
+++ echo 10.156.0.0
++ netwo