From cfb80376641fa49137b9996130352697e7f8b436 Mon Sep 17 00:00:00 2001
From: Sebastien Bacher no.
NM_CLOUD_SETUP_GCP: boolean, whether Google GCP support is enabled. Defaults
to no.
NM_CLOUD_SETUP_ALIYUN: boolean, whether Alibaba Cloud (Aliyun) support is enabled. Defaults
+ to no.
For Aliyun, the tools tries to fetch configuration from http://100.100.100.200/. Currently, it only
+ configures IPv4 and does nothing about IPv6. It will do the following.
First fetch http://100.100.100.200/2016-01-01/meta-data/ to determine whether the
+ expected API is present. This determines whether Aliyun environment is detected and whether to proceed
+ to configure the host using Aliyun meta data.
Fetch http://100.100.100.200/2016-01-01/meta-data/network/interfaces/macs/ to get the list
+ of available interface. Interfaces are identified by their MAC address.
Then for each interface fetch http://100.100.100.200/2016-01-01/meta-data/network/interfaces/macs/$MAC/vpc-cidr-block
+ , http://100.100.100.200/2016-01-01/meta-data/network/interfaces/macs/$MAC/private-ipv4s and
+ http://100.100.100.200/2016-01-01/meta-data/network/interfaces/macs/$MAC/netmask.
+ Thereby we get a list of private IPv4 addresses, one CIDR subnet block and private IPv4 addresses prefix.
Then nm-cloud-setup iterates over all interfaces for which it could fetch IP configuration.
+ If no ethernet device for the respective MAC address is found, it is skipped.
+ Also, if the device is currently not activated in NetworkManager or if the currently
+ activated profile has a user-data org.freedesktop.nm-cloud-setup.skip=yes,
+ it is skipped.
Then, the tool will change the runtime configuration of the device. +
+Add static IPv4 addresses for all the configured addresses from private-ipv4s with
+ prefix length according to netmask. For example,
+ we might have here 2 IP addresses like "10.0.0.150/24,10.0.0.152/24".
Choose a route table 30400 + the index of the interface and
+ add a default route 0.0.0.0/0. The gateway
+ is the default gateway retrieved from metadata server. For
+ example, we might get a route "0.0.0.0/0 10.0.0.253 10 table=30400".
Finally, add a policy routing rule for each address. For example
+ "priority 30400 from 10.0.0.150/32 table 30400, priority 30400 from 10.0.0.152/32 table 30400".
+ With above example, this roughly corresponds for interface eth0 to
+ nmcli device modify "eth0" ipv4.addresses "10.0.0.150/24,10.0.0.152/24" ipv4.routes "0.0.0.0/0 10.0.0.253 10 table=30400" ipv4.routing-rules "priority 30400 from 10.0.0.150/32 table 30400, priority 30400 from 10.0.0.152/32 table 30400".
+ Note that this replaces the previous addresses, routes and rules with the new information.
+ But also note that this only changes the run time configuration of the device. The
+ connection profile on disk is not affected.
+