mirror of
https://github.com/unraid/webgui.git
synced 2026-01-14 13:39:58 -06:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -321,16 +321,21 @@
|
||||
$intCPUThreadsPerCore = 1;
|
||||
|
||||
$cpumode = '';
|
||||
$cpucache = '';
|
||||
$cpufeatures = '';
|
||||
if (!empty($domain['cpumode']) && $domain['cpumode'] == 'host-passthrough') {
|
||||
$cpumode .= "mode='host-passthrough'";
|
||||
$cpucache = "<cache mode='passthrough'/>";
|
||||
|
||||
// detect if the processor is hyperthreaded:
|
||||
$intCPUThreadsPerCore = max(intval(shell_exec('/usr/bin/lscpu | grep \'Thread(s) per core\' | awk \'{print $4}\'')), 1);
|
||||
|
||||
// detect if the processor is AMD, and if so, force single threaded
|
||||
$strCPUInfo = file_get_contents('/proc/cpuinfo');
|
||||
if (strpos($strCPUInfo, 'AuthenticAMD') !== false) {
|
||||
$intCPUThreadsPerCore = 1;
|
||||
|
||||
// detect if the processor is AMD + multithreaded, and if so, enable topoext cpu feature
|
||||
if ($intCPUThreadsPerCore > 1) {
|
||||
$strCPUInfo = file_get_contents('/proc/cpuinfo');
|
||||
if (strpos($strCPUInfo, 'AuthenticAMD') !== false) {
|
||||
$cpufeatures .= "<feature policy='require' name='topoext'/>";
|
||||
}
|
||||
}
|
||||
|
||||
// even amount of cores assigned and cpu is hyperthreaded: pass that info along to the cpu section below
|
||||
@@ -342,6 +347,8 @@
|
||||
|
||||
$cpustr = "<cpu $cpumode>
|
||||
<topology sockets='1' cores='{$intCores}' threads='{$intThreads}'/>
|
||||
$cpucache
|
||||
$cpufeatures
|
||||
</cpu>
|
||||
<vcpu placement='static'>{$vcpus}</vcpu>
|
||||
<cputune>
|
||||
|
||||
@@ -827,7 +827,6 @@
|
||||
'cz' => 'Czech (cz)',
|
||||
'da' => 'Danish (da)',
|
||||
'nl' => 'Dutch (nl)',
|
||||
'nl-be' => 'Dutch-Belgium (nl-be)',
|
||||
'en-gb' => 'English-United Kingdom (en-gb)',
|
||||
'en-us' => 'English-United States (en-us)',
|
||||
'es' => 'Español (es)',
|
||||
|
||||
@@ -307,7 +307,7 @@ function getLibvirtSchema() {
|
||||
autoport: ["yes", "no"],
|
||||
websocket: ["-1"],
|
||||
listen: ["0.0.0.0"],
|
||||
keymap: ["en-us", "en-gb", "ar", "hr", "cz", "da", "nl", "nl-be", "es", "et", "fo",
|
||||
keymap: ["en-us", "en-gb", "ar", "hr", "cz", "da", "nl", "es", "et", "fo",
|
||||
"fi", "fr", "bepo", "fr-be", "fr-ca", "fr-ch", "de-ch", "hu", "is", "it",
|
||||
"ja", "lv", "lt", "mk", "no", "pl", "pt-br", "ru", "sl", "sv", "th", "tr"]
|
||||
}
|
||||
@@ -373,4 +373,4 @@ function getLibvirtSchema() {
|
||||
|
||||
return root;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,45 +89,6 @@
|
||||
]]>
|
||||
</Script>
|
||||
</Agent>
|
||||
<Agent>
|
||||
<Name>Notify My Android</Name>
|
||||
<Variables>
|
||||
<Variable Help="The API key can be found [a href='https://www.notifymyandroid.com/account.jsp' target='_blank'] [u]here[/u].[/a]" Desc="API key" Default="">API_KEY</Variable>
|
||||
<Variable Help="Application name, e.g., Unraid Server." Desc="Application Name" Default="Unraid Server">APP_NAME</Variable>
|
||||
<Variable Help="Specify the fields which are included in the title of the notification." Desc="Notification Title" Default="$SUBJECT">TITLE</Variable>
|
||||
<Variable Help="Specify the fields which are included in the message body of the notification." Desc="Notification Message" Default="$DESCRIPTION">MESSAGE</Variable>
|
||||
</Variables>
|
||||
<Script>
|
||||
<![CDATA[
|
||||
#!/bin/bash
|
||||
##########
|
||||
{0}
|
||||
##########
|
||||
TITLE=$(echo -e "$TITLE")
|
||||
MESSAGE=$(echo -e "$MESSAGE")
|
||||
|
||||
case "$IMPORTANCE" in
|
||||
'normal' )
|
||||
PRIORITY="0"
|
||||
;;
|
||||
'warning' )
|
||||
PRIORITY="1"
|
||||
;;
|
||||
'alert' )
|
||||
PRIORITY="2"
|
||||
;;
|
||||
esac
|
||||
|
||||
curl -s -k \
|
||||
-d "apikey=$API_KEY" \
|
||||
-d "application=$APP_NAME" \
|
||||
-d "event=$TITLE" \
|
||||
-d "description=$MESSAGE" \
|
||||
-d "priority=$PRIORITY" \
|
||||
https://www.notifymyandroid.com/publicapi/notify 2>&1
|
||||
]]>
|
||||
</Script>
|
||||
</Agent>
|
||||
<Agent>
|
||||
<Name>Prowl</Name>
|
||||
<Variables>
|
||||
|
||||
@@ -33,12 +33,8 @@ case 'vm':
|
||||
// initial cores/threads assignment
|
||||
$cores = $vcpus;
|
||||
$threads = 1;
|
||||
$vendor = exec("grep -Pom1 '^vendor_id\\s+: \\K\\S+' /proc/cpuinfo");
|
||||
if ($vendor == 'AuthenticAMD') {
|
||||
$ht = 1; // force single threaded for AMD
|
||||
} else {
|
||||
$ht = exec("lscpu|grep -Po '^Thread\\(s\\) per core:\\s+\\K\\d+'") ?: 1; // fetch hyperthreading
|
||||
}
|
||||
$ht = exec("lscpu|grep -Po '^Thread\\(s\\) per core:\\s+\\K\\d+'") ?: 1; // fetch hyperthreading
|
||||
|
||||
// adjust for hyperthreading
|
||||
if ($vcpus > $ht && $vcpus%$ht===0) {
|
||||
$cores /= $ht;
|
||||
|
||||
Reference in New Issue
Block a user