Giter VIP home page Giter VIP logo

addon-context-alpine's People

Contributors

florianheigl avatar jfontan avatar rsmontero avatar vholer avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

feldsam-inc bewie

addon-context-alpine's Issues

Handle gateway metric on OpenNebula vrouter (Alpine) - v 5.2

Issue from Nicolas Belan

Hi,
When using multiple network on vrouter, you may have multiple default gateway defined (1 per vnet)

To choose the right gateway, it is possible to set "metric", as in:

localhost:~# cat /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
  address 172.25.104.254
  network 172.25.104.0
  netmask 255.255.255.0
  gateway 172.25.104.254
  metric 1000

auto eth1
iface eth1 inet static
  address 172.25.101.201
  network 172.25.101.0
  netmask 255.255.0.0
  gateway 172.25.8.20
  metric 101

Metric may be set in context variable, and retrieve from context, using something like:

# Gets the gateway metric
get_metric() {
    if is_gateway; then
        metric=$(get_iface_var "METRIC")

        if [ -z "$metric" ]; then
            if [ "$DEV" = "eth0" ]; then
                metric=1000
            else
                metric=$((100+$IFACE_NUM))
            fi
        fi

        echo $metric
   fi
}
Using that code, by default, the second network interface is the default gateway (1=LAN, 2=WAN), and that can be change using ETH{X}_METRIC=10

Perhaps a hardcoded "eth0" is not correct; but this is a starting point.

Adding the right call "METRIC=$(get_metric)" in the interface loop, this makes the job for me :)
--- /etc/one-context.d/00-network.orig
+++ /etc/one-context.d/00-network
@@ -88,7 +88,23 @@
         echo $gateway
     fi
 }
+# Gets the gateway metric
+get_metric() {
+    if is_gateway; then
+        metric=$(get_iface_var "METRIC")

+        if [ -z "$metric" ]; then
+            if [ "$DEV" = "eth0" ]; then
+                metric=1000
+            else
+                metric=$((100+$IFACE_NUM))
+            fi
+        fi
+
+        echo $metric
+   fi
+}
+
 # Gets the network gateway6
 get_gateway6() {
     if is_gateway; then
@@ -147,6 +163,10 @@
         echo "  gateway $GATEWAY6" 
     fi

+    if [ -n "$METRIC" ]; then
+        echo "  metric $METRIC" 
+    fi
+
     echo "" 
 }

@@ -191,6 +211,7 @@
         MASK=$(get_mask)
         MTU=$(get_mtu)
         GATEWAY=$(get_gateway)
+        METRIC=$(get_metric)

         IPV6=$(get_iface_var "IPV6")
         [[ -z $IPV6 ]] && IPV6=$(get_iface_var "IP6")

Do not generate gateway from network address

If gateway is not set it is generated using the network address:

        if [ -z "$gateway" ]; then
            if [ "$DEV" = "eth0" ]; then
                net_prefix=$(echo $NETWORK | cut -d'.' -f1,2,3)
                gateway="${net_prefix}.1"
            fi
        fi

Disable this behavior and only configure gateway when its explicitly set.

install and enable acpi for VM types other than xen pv

We should probably by default install acpi and enable it, unless we're in a xen pv domU.
(Or just disable it on first boot if /proc/xen is present)

For anything else, OpenNebula doesn't know how to shut it down (not exposed by hypervisor & no event channel)
It seems by default, without acpi(d) alpine won't do a shut down action on power button press.

Could someone confirm?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.