ssvm: apply MTU value on storage/management nic if available (#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 #3369

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2019-06-04 15:53:51 +05:30 committed by GitHub
parent 12c850ed2f
commit 42501ceecf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 0 deletions

View File

@ -257,6 +257,30 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
_inSystemVM = inSystemVM;
}
/**
* Applies MTU per the "mtu" value from params
* @param params
*/
public static void applyMtu(Map<String, Object> params) {
if (params == null || params.get("mtu") == null) {
return;
}
final Integer mtu = NumbersUtil.parseInt((String) params.get("mtu"), 0);
if (mtu > 0) {
final Script command = new Script("/sbin/ip", s_logger);
command.add("link");
command.add("set");
command.add("dev");
command.add("eth1");
command.add("mtu");
command.add(String.valueOf(mtu));
final String result = command.execute();
if (result != null) {
s_logger.warn("Error in setting MTU on storage/management nic: " + result);
}
}
}
/**
* Retrieve converted "nfsVersion" value from params
* @param params
@ -2605,6 +2629,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
}
startAdditionalServices();
applyMtu(params);
_params.put("install.numthreads", "50");
_params.put("secondary.storage.vm", "true");
_nfsVersion = retrieveNfsVersionFromParams(params);