Added CPU isolation

Both CPU pinning and CPU isolation is possible thru the GUI
This commit is contained in:
bergware
2018-09-04 12:18:01 +02:00
parent e55ea90f59
commit 62e05ca5ed
5 changed files with 170 additions and 16 deletions
+9 -1
View File
@@ -20,7 +20,7 @@ foreach($_POST as $key => $val) {
list($name,$cpu) = explode(':',$key);
$map[urldecode($name)] .= "$cpu,";
}
// map holds the list of each vm or container and its newly proposed cpu assignments
// map holds the list of each vm, container or isolcpus and its newly proposed cpu assignments
$map = array_map(function($d){return substr($d,0,-1);},$map);
switch ($_POST['id']) {
@@ -72,6 +72,14 @@ case 'ct':
}
$reply = ['success' => (count($changes) ? implode(';',$changes) : '')];
break;
case 'is':
// report changed isolcpus in temporary file
foreach ($map as $name => $isolcpu) {
file_put_contents("/var/tmp/$name.tmp",$isolcpu);
$changes[] = $name;
}
$reply = ['success' => (count($changes) ? implode(';',$changes) : '')];
break;
}
// signal changes
header('Content-Type: application/json');