From 42501ceecf90683440c97df740c5fa62f09df4f6 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Tue, 4 Jun 2019 15:53:51 +0530 Subject: [PATCH] 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 --- .../resource/NfsSecondaryStorageResource.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java b/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java index 46fa1707a03..be68f63ed91 100644 --- a/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java +++ b/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java @@ -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 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);