wip on per ns sysctl
Signed-off-by: Benjamin Hesmans <benjamin.hesmans@uclouvain.be>
This commit is contained in:
parent
6576eb330f
commit
13d9bdb635
@ -62,14 +62,27 @@ class MpExperience:
|
|||||||
|
|
||||||
def saveSysctl(self):
|
def saveSysctl(self):
|
||||||
self.sysctlBUP = {}
|
self.sysctlBUP = {}
|
||||||
for k in MpParamXp.sysctlKey:
|
self._saveSysctl(MpParamXp.sysctlKey, self.sysctlBUP)
|
||||||
sysctlKey = MpParamXp.sysctlKey[k]
|
self.sysctlBUPC = {}
|
||||||
|
self._saveSysctl(MpParamXp.sysctlKeyClient, self.sysctlBUPC,
|
||||||
|
ns = True, who = self.mpConfig.client)
|
||||||
|
self.sysctlBUPS = {}
|
||||||
|
self._saveSysctl(MpParamXp.sysctlKeyServer, self.sysctlBUPS,
|
||||||
|
ns = True, who = self.mpConfig.server)
|
||||||
|
|
||||||
|
def _saveSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None):
|
||||||
|
for k in sysctlDic:
|
||||||
|
sysctlKey = sysctlDic[k]
|
||||||
cmd = self.cmdReadSysctl(sysctlKey)
|
cmd = self.cmdReadSysctl(sysctlKey)
|
||||||
|
if not ns:
|
||||||
val = self.mpTopo.notNSCommand(cmd)
|
val = self.mpTopo.notNSCommand(cmd)
|
||||||
|
else:
|
||||||
|
val = self.mpTopo.commandTo(who, cmd)
|
||||||
if val == "Error":
|
if val == "Error":
|
||||||
print("oooops can't get sysctl " + sysctlKey)
|
print("oooops can't get sysctl " + sysctlKey)
|
||||||
else:
|
else:
|
||||||
self.sysctlBUP[k] = val.split(" ",2)[2][:-1]
|
sysctlBUP[k] = val.split(" ",2)[2][:-1]
|
||||||
|
|
||||||
|
|
||||||
def cmdReadSysctl(self, key):
|
def cmdReadSysctl(self, key):
|
||||||
s = "sysctl " + key
|
s = "sysctl " + key
|
||||||
@ -81,23 +94,47 @@ class MpExperience:
|
|||||||
return s
|
return s
|
||||||
|
|
||||||
def writeSysctl(self):
|
def writeSysctl(self):
|
||||||
for k in self.sysctlBUP:
|
self._writeSysctl(MpParamXp.sysctlKey, self.sysctlBUP)
|
||||||
sysctlKey = MpParamXp.sysctlKey[k]
|
self._writeSysctl(MpParamXp.sysctlKeyClient, self.sysctlBUPC,
|
||||||
|
ns = True, who = self.mpConfig.client)
|
||||||
|
self._writeSysctl(MpParamXp.sysctlKeyServer, self.sysctlBUPS,
|
||||||
|
ns = True, who = self.mpConfig.server)
|
||||||
|
|
||||||
|
def _writeSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None):
|
||||||
|
for k in sysctlBUP:
|
||||||
|
sysctlKey = sysctlDic[k]
|
||||||
sysctlValue = self.xpParam.getParam(k)
|
sysctlValue = self.xpParam.getParam(k)
|
||||||
cmd = self.cmdWriteSysctl(sysctlKey,sysctlValue)
|
cmd = self.cmdWriteSysctl(sysctlKey,sysctlValue)
|
||||||
|
if not ns:
|
||||||
val = self.mpTopo.notNSCommand(cmd)
|
val = self.mpTopo.notNSCommand(cmd)
|
||||||
|
else:
|
||||||
|
val = self.mpTopo.commandTo(who, cmd)
|
||||||
if val == "Error":
|
if val == "Error":
|
||||||
print("oooops can't set sysctl " + sysctlKey)
|
print("oooops can't set sysctl " + sysctlKey)
|
||||||
|
|
||||||
|
|
||||||
def backUpSysctl(self):
|
def backUpSysctl(self):
|
||||||
for k in self.sysctlBUP:
|
self._backUpSysctl(MpParamXp.sysctlKey, self.sysctlBUP)
|
||||||
sysctlKey = MpParamXp.sysctlKey[k]
|
self._backUpSysctl(MpParamXp.sysctlKeyClient, self.sysctlBUPC,
|
||||||
sysctlValue = self.sysctlBUP[k]
|
ns = True, who = self.mpConfig.client)
|
||||||
|
self._backUpSysctl(MpParamXp.sysctlKeyServer, self.sysctlBUPS,
|
||||||
|
ns = True, who = self.mpConfig.server)
|
||||||
|
|
||||||
|
|
||||||
|
def _backUpSysctl(self, sysctlDic, sysctlBUP, ns = False, who = None):
|
||||||
|
for k in sysctlBUP:
|
||||||
|
sysctlKey = sysctlKey[k]
|
||||||
|
sysctlValue = sysctlBUP[k]
|
||||||
cmd = self.cmdWriteSysctl(sysctlKey,sysctlValue)
|
cmd = self.cmdWriteSysctl(sysctlKey,sysctlValue)
|
||||||
|
if not ns:
|
||||||
val = self.mpTopo.notNSCommand(cmd)
|
val = self.mpTopo.notNSCommand(cmd)
|
||||||
|
else:
|
||||||
|
val = self.mpTopo.commandTo(who, cmd)
|
||||||
|
|
||||||
if val == "Error":
|
if val == "Error":
|
||||||
print("oooops can't set sysctl " + sysctlKey)
|
print("oooops can't set sysctl " + sysctlKey)
|
||||||
|
|
||||||
|
|
||||||
def runTcpDump(self):
|
def runTcpDump(self):
|
||||||
#todo : replace filename by cst
|
#todo : replace filename by cst
|
||||||
cpcap = self.xpParam.getParam(MpParamXp.CLIENTPCAP)
|
cpcap = self.xpParam.getParam(MpParamXp.CLIENTPCAP)
|
||||||
|
@ -5,6 +5,8 @@ class MpParamXp(MpParam):
|
|||||||
RMEM = "rmem"
|
RMEM = "rmem"
|
||||||
SCHED = "sched"
|
SCHED = "sched"
|
||||||
KERNELPM = "kpm"
|
KERNELPM = "kpm"
|
||||||
|
KERNELPMC = "kpmc" #kernel path manager client / server
|
||||||
|
KERNELPMS = "kpms"
|
||||||
CLIENTPCAP = "clientPcap"
|
CLIENTPCAP = "clientPcap"
|
||||||
SERVERPCAP = "serverPcap"
|
SERVERPCAP = "serverPcap"
|
||||||
XPTYPE = "xpType"
|
XPTYPE = "xpType"
|
||||||
@ -26,13 +28,17 @@ class MpParamXp(MpParam):
|
|||||||
sysctlKey[KERNELPM] = "net.mptcp.mptcp_path_manager"
|
sysctlKey[KERNELPM] = "net.mptcp.mptcp_path_manager"
|
||||||
sysctlKey[SCHED] = "net.mptcp.mptcp_scheduler"
|
sysctlKey[SCHED] = "net.mptcp.mptcp_scheduler"
|
||||||
|
|
||||||
sysctlListClient = []
|
sysctlKeyClient = {}
|
||||||
sysctlListServer = []
|
sysctlKeyClient[KERNELPMC] = "net.mptcp.mptcp_path_manager"
|
||||||
|
sysctlKeyServer = {}
|
||||||
|
sysctlKeyServer[KERNELPMS] = "net.mptcp.mptcp_path_manager"
|
||||||
|
|
||||||
defaultValue = {}
|
defaultValue = {}
|
||||||
|
|
||||||
defaultValue[RMEM] = "10240 87380 16777216"
|
defaultValue[RMEM] = "10240 87380 16777216"
|
||||||
defaultValue[KERNELPM] = "fullmesh"
|
defaultValue[KERNELPM] = "fullmesh"
|
||||||
|
defaultValue[KERNELPMC] = "fullmesh"
|
||||||
|
defaultValue[KERNELPMS] = "fullmesh"
|
||||||
defaultValue[SCHED] = "default"
|
defaultValue[SCHED] = "default"
|
||||||
|
|
||||||
defaultValue[CLIENTPCAP] = "no"
|
defaultValue[CLIENTPCAP] = "no"
|
||||||
|
Loading…
Reference in New Issue
Block a user