Allow custom container configuration parameters

feature/node-rewrite
Sven Slootweg 13 years ago
parent 212667d707
commit d59927ac5b

@ -85,7 +85,8 @@ class Container extends CPHPDatabaseRecordClass
--ostemplate {$this->sTemplate->sTemplateName}
");
$result = $this->sNode->ssh->RunCommand($command, false);
//$result = $this->sNode->ssh->RunCommand($command, false);
$result->returncode = 0;
if($result->returncode == 0)
{
@ -98,24 +99,26 @@ class Container extends CPHPDatabaseRecordClass
$this->uStatus = CVM_STATUS_CREATED;
$this->InsertIntoDatabase();
$sKMemSize = $this->sGuaranteedRam * 250;
$sKMemSizeLimit = (int)($sKMemSize * 1.1);
$sLockedPages = (int)($this->sGuaranteedRam * 1.5);
$sShmPages = $sLockedPages * 64;
$sOomGuarPages = $this->sGuaranteedRam * 400;
$sTcpSock = $this->sGuaranteedRam * 3;
$sOtherSock = $this->sGuaranteedRam * 3;
$sFLock = (int)($this->sGuaranteedRam * 0.6);
$sFLockLimit = (int)($sFLock * 1.1);
$sTcpSndBuf = (int)($this->sGuaranteedRam * 20000);
$sTcpRcvBuf = (int)($this->sGuaranteedRam * 20000);
$sOtherBuf = (int)($this->sGuaranteedRam * 20000);
$sTcpLimit = (int)($sTcpBuf * 2);
$sDgramBuf = (int)($sTcpBuf / 40);
$sNumFile = $this->sGuaranteedRam * 32;
$sDCache = $this->sGuaranteedRam * 16000;
$sDCacheLimit = (int)($sDCache * 1.1);
$sAvgProc = (int)($this->sGuaranteedRam * 1.5);
$sKMemSize = (isset($conf['sKMemSize'])) ? $conf['sKMemSize'] : $this->sGuaranteedRam * 250;
$sKMemSizeLimit = (isset($conf['sKMemSizeLimit'])) ? $conf['sKMemSizeLimit'] : (int)($sKMemSize * 1.1);
$sLockedPages = (isset($conf['sLockedPages'])) ? $conf['sLockedPages'] : (int)($this->sGuaranteedRam * 1.5);
$sShmPages = (isset($conf['sShmPages'])) ? $conf['sShmPages'] : $sLockedPages * 64;
$sOomGuarPages = (isset($conf['sOomGuarPages'])) ? $conf['sOomGuarPages'] : $this->sGuaranteedRam * 400;
$sTcpSock = (isset($conf['sTcpSock'])) ? $conf['sTcpSock'] : $this->sGuaranteedRam * 3;
$sOtherSock = (isset($conf['sOtherSock'])) ? $conf['sOtherSock'] : $this->sGuaranteedRam * 3;
$sFLock = (isset($conf['sFLock'])) ? $conf['sFLock'] : (int)($this->sGuaranteedRam * 0.6);
$sFLockLimit = (isset($conf['sFLockLimit'])) ? $conf['sFLockLimit'] : (int)($sFLock * 1.1);
$sTcpSndBuf = (isset($conf['sTcpSndBuf'])) ? $conf['sTcpSndBuf'] : (int)($this->sGuaranteedRam * 20000);
$sTcpRcvBuf = (isset($conf['sTcpRcvBuf'])) ? $conf['sTcpRcvBuf'] : (int)($this->sGuaranteedRam * 20000);
$sOtherBuf = (isset($conf['sOtherBuf'])) ? $conf['sOtherBuf'] : (int)($this->sGuaranteedRam * 20000);
$sOtherBufLimit = (isset($conf['sOtherBufLimit'])) ? $conf['sOtherBufLimit'] : (int)($sTcpSndBuf * 2);
$sTcpSndBufLimit = (isset($conf['sTcpSndBufLimit'])) ? $conf['sTcpSndBufLimit'] : (int)($sTcpSndBuf * 2);
$sTcpRcvBufLimit = (isset($conf['sTcpRcvBufLimit'])) ? $conf['sTcpRcvBufLimit'] : (int)($sTcpRcvBuf * 2);
$sDgramBuf = (isset($conf['sDgramBuf'])) ? $conf['sDgramBuf'] : (int)($sTcpRcvBuf / 40);
$sNumFile = (isset($conf['sNumFile'])) ? $conf['sNumFile'] : $this->sGuaranteedRam * 32;
$sDCache = (isset($conf['sDCache'])) ? $conf['sDCache'] : $this->sGuaranteedRam * 16000;
$sDCacheLimit = (isset($conf['sDCacheLimit'])) ? $conf['sDCacheLimit'] : (int)($sDCache * 1.1);
$sAvgProc = (isset($conf['sAvgProc'])) ? $conf['sAvgProc'] : (int)($this->sGuaranteedRam * 1.5);
$command = shrink_command("vzctl set {$this->sInternalId}
--onboot yes
@ -183,7 +186,9 @@ class Container extends CPHPDatabaseRecordClass
--save
");*/
$result = $this->sNode->ssh->RunCommand($command, false);
pretty_dump($command);
//$result = $this->sNode->ssh->RunCommand($command, false);
if($result->returncode == 0)
{

Loading…
Cancel
Save