Skip to content

Commit 831f7cf

Browse files
raveningRakesh Venkatesh
andauthored
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>
1 parent 4e826d5 commit 831f7cf

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

server/src/main/java/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1254,8 +1254,11 @@ public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, Depl
12541254

12551255
if (nic.getTrafficType() == TrafficType.Management) {
12561256
String mgmt_cidr = configurationDao.getValue(Config.ManagementNetwork.key());
1257-
if (NetUtils.isValidIp4Cidr(mgmt_cidr)) {
1257+
if (NetUtils.isValidCidrList(mgmt_cidr)) {
1258+
s_logger.debug("Management server cidr list is " + mgmt_cidr);
12581259
buf.append(" mgmtcidr=").append(mgmt_cidr);
1260+
} else {
1261+
s_logger.error("Invalid management cidr list: " + mgmt_cidr);
12591262
}
12601263
buf.append(" localgw=").append(dest.getPod().getGateway());
12611264
}

services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1125,8 +1125,11 @@ public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, Depl
11251125
}
11261126
if (nic.getTrafficType() == TrafficType.Management) {
11271127
String mgmt_cidr = _configDao.getValue(Config.ManagementNetwork.key());
1128-
if (NetUtils.isValidIp4Cidr(mgmt_cidr)) {
1128+
if (NetUtils.isValidCidrList(mgmt_cidr)) {
1129+
s_logger.debug("Management server cidr list is " + mgmt_cidr);
11291130
buf.append(" mgmtcidr=").append(mgmt_cidr);
1131+
} else {
1132+
s_logger.error("Inavlid management server cidr list: " + mgmt_cidr);
11301133
}
11311134
buf.append(" localgw=").append(dest.getPod().getGateway());
11321135
buf.append(" private.network.device=").append("eth").append(deviceId);

systemvm/debian/opt/cloud/bin/setup/common.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,12 @@ setup_common() {
322322

323323
if [ -n "$MGMTNET" -a -n "$LOCAL_GW" ]
324324
then
325-
ip route add $MGMTNET via $LOCAL_GW dev eth1
325+
log_it "Received mgmt cidr : $MGMTNET"
326+
cidrs=(${MGMTNET//,/ })
327+
for cidr in ${cidrs[@]}
328+
do
329+
ip route add $cidr via $LOCAL_GW dev eth1
330+
done
326331
fi
327332

328333
ip route delete default

0 commit comments

Comments
 (0)