Skip to content

Commit 42501ce

Browse files
authored
ssvm: apply MTU value on storage/management nic if available (apache#3370)
If mtu= value is defined in the parameters received by the SSVM agent per the secstorage.vm.mtu.size setting, it applies the MTU setting on eth1 which is the storage/management nic. Fixes apache#3369 Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 12c850e commit 42501ce

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,30 @@ public void setInSystemVM(boolean inSystemVM) {
257257
_inSystemVM = inSystemVM;
258258
}
259259

260+
/**
261+
* Applies MTU per the "mtu" value from params
262+
* @param params
263+
*/
264+
public static void applyMtu(Map<String, Object> params) {
265+
if (params == null || params.get("mtu") == null) {
266+
return;
267+
}
268+
final Integer mtu = NumbersUtil.parseInt((String) params.get("mtu"), 0);
269+
if (mtu > 0) {
270+
final Script command = new Script("/sbin/ip", s_logger);
271+
command.add("link");
272+
command.add("set");
273+
command.add("dev");
274+
command.add("eth1");
275+
command.add("mtu");
276+
command.add(String.valueOf(mtu));
277+
final String result = command.execute();
278+
if (result != null) {
279+
s_logger.warn("Error in setting MTU on storage/management nic: " + result);
280+
}
281+
}
282+
}
283+
260284
/**
261285
* Retrieve converted "nfsVersion" value from params
262286
* @param params
@@ -2605,6 +2629,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
26052629
}
26062630

26072631
startAdditionalServices();
2632+
applyMtu(params);
26082633
_params.put("install.numthreads", "50");
26092634
_params.put("secondary.storage.vm", "true");
26102635
_nfsVersion = retrieveNfsVersionFromParams(params);

0 commit comments

Comments
 (0)