Support mutiple management networks in systemvms (#4678)

* Support mutliple management networks in systemvms

Currently only one management.network.cidr is suuported in systemvms
Allow supporting comma separated list of cidr's so that multiple
networks are reachable from systemvms.

* add local gateway

Co-authored-by: Rakesh Venkatesh <rakeshv@apache.org>
This commit is contained in:
Rakesh 2022-02-22 12:11:31 +01:00 committed by GitHub
parent 4e826d504e
commit 831f7cff54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -1254,8 +1254,11 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
if (nic.getTrafficType() == TrafficType.Management) {
String mgmt_cidr = configurationDao.getValue(Config.ManagementNetwork.key());
if (NetUtils.isValidIp4Cidr(mgmt_cidr)) {
if (NetUtils.isValidCidrList(mgmt_cidr)) {
s_logger.debug("Management server cidr list is " + mgmt_cidr);
buf.append(" mgmtcidr=").append(mgmt_cidr);
} else {
s_logger.error("Invalid management cidr list: " + mgmt_cidr);
}
buf.append(" localgw=").append(dest.getPod().getGateway());
}

View File

@ -1125,8 +1125,11 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
}
if (nic.getTrafficType() == TrafficType.Management) {
String mgmt_cidr = _configDao.getValue(Config.ManagementNetwork.key());
if (NetUtils.isValidIp4Cidr(mgmt_cidr)) {
if (NetUtils.isValidCidrList(mgmt_cidr)) {
s_logger.debug("Management server cidr list is " + mgmt_cidr);
buf.append(" mgmtcidr=").append(mgmt_cidr);
} else {
s_logger.error("Inavlid management server cidr list: " + mgmt_cidr);
}
buf.append(" localgw=").append(dest.getPod().getGateway());
buf.append(" private.network.device=").append("eth").append(deviceId);

View File

@ -322,7 +322,12 @@ setup_common() {
if [ -n "$MGMTNET" -a -n "$LOCAL_GW" ]
then
ip route add $MGMTNET via $LOCAL_GW dev eth1
log_it "Received mgmt cidr : $MGMTNET"
cidrs=(${MGMTNET//,/ })
for cidr in ${cidrs[@]}
do
ip route add $cidr via $LOCAL_GW dev eth1
done
fi
ip route delete default