diff --git a/deployment/puppet/cluster/manifests/virtual_ip.pp b/deployment/puppet/cluster/manifests/virtual_ip.pp index 073ab49dd1..e4cb32b79b 100644 --- a/deployment/puppet/cluster/manifests/virtual_ip.pp +++ b/deployment/puppet/cluster/manifests/virtual_ip.pp @@ -18,6 +18,7 @@ define cluster::virtual_ip ( $vip, $key = $name, ){ + $vip_name = "vip__${key}" $parameters = { @@ -37,10 +38,6 @@ define cluster::virtual_ip ( undef => 'haproxy', default => $vip['namespace'] }, - 'gateway' => $vip['gateway'] ? { - undef => undef, - default => $vip['gateway'] - }, 'gateway_metric' => $vip['gateway_metric'] ? { undef => undef, default => $vip['gateway_metric'] @@ -63,6 +60,12 @@ define cluster::virtual_ip ( }, } + if (is_ip_address($vip['gateway']) or ($vip['gateway'] == 'link')) { + $parameters['gateway'] = $vip['gateway'] + } else { + $parameters['gateway'] = 'none' + } + $metadata = { 'migration-threshold' => '3', # will be try start 3 times before migrate to another node 'failure-timeout' => '60', # forget any fails of starts after this timeout diff --git a/files/fuel-ha-utils/ocf/ns_IPaddr2 b/files/fuel-ha-utils/ocf/ns_IPaddr2 index 2554aedaf4..ab3d00e34f 100755 --- a/files/fuel-ha-utils/ocf/ns_IPaddr2 +++ b/files/fuel-ha-utils/ocf/ns_IPaddr2 @@ -10,7 +10,7 @@ OCF_RESKEY_cidr_netmask_default="32" OCF_RESKEY_base_veth_default="" # may be omited if OVS used -OCF_RESKEY_gateway_default="" # can be "none", "link", IPaddr +OCF_RESKEY_gateway_default="none" # can be "none", "link", IPaddr OCF_RESKEY_gateway_metric_default=0 # can be "", or metric value OCF_RESKEY_also_check_interfaces_default="" # can be "", or list of interfaces OCF_RESKEY_other_networks_default="" # can be "", or list of networks in CIDR format @@ -288,7 +288,7 @@ add_to_bridge() { fi else # OVS - ovs-vsctl show | grep $veth + ovs-vsctl list port $veth > /dev/null 2>&1 if [[ $? != 0 ]] ; then # attach 1-st jack to an OVS bridge ocf_run ovs-vsctl --may-exist add-port $br $veth || return $OCF_ERR_GENERIC @@ -310,7 +310,7 @@ remove_from_bridge() { fi else # OVS bridge - ocf_run ovs-vsctl del-port $OCF_RESKEY_bridge $OCF_RESKEY_veth || return $OCF_ERR_GENERIC + ocf_run ovs-vsctl del-port $OCF_RESKEY_bridge $OCF_RESKEY_base_veth || return $OCF_ERR_GENERIC fi return $OCF_SUCCESS } @@ -387,7 +387,7 @@ ip_prepare() { if [[ $OCF_RESKEY_gateway == 'link' ]] ; then ocf_run $RUN_IN_NS ip route replace default dev $OCF_RESKEY_ns_veth metric $OCF_RESKEY_gateway_metric elif [[ $OCF_RESKEY_gateway == 'none' ]] ; then - echo "Do nothing" + echo "Setup default gateway -- do nothing." else ocf_run $RUN_IN_NS ip route replace default via $OCF_RESKEY_gateway metric $OCF_RESKEY_gateway_metric fi