diff --git a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php index 25e63c2fd..081b3da68 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php +++ b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php @@ -55,6 +55,22 @@ return ($tmp) ? $tmp : $this->_set_last_error(); } + function get_domain_capabilities($emulatorbin, $arch, $machine, $virttype, $xpath) { + + #@conn [resource]: resource for connection + #@emulatorbin [string]: optional path to emulator + #@arch [string]: optional domain architecture + #@machine [string]: optional machine type + #@virttype [string]: optional virtualization type + #@flags [int] : extra flags; not used yet, so callers should always pass 0 + #@xpath [string]: optional xPath query to be applied on the result + #Returns: : domain capabilities XML from the connection or FALSE for error + + $tmp = libvirt_connect_get_domain_capabilities($this->conn, $emulatorbin, $arch, $machine, $virttype, 0, $xpath); + return ($tmp) ? $tmp : $this->_set_last_error(); + } + + function get_machine_types($arch = 'x86_64' /* or 'i686' */) { $tmp = libvirt_connect_get_machine_types($this->conn); @@ -383,6 +399,10 @@ $cpucache = ''; $cpufeatures = ''; $cpumigrate = ''; + $cpucheck = ''; + $cpumatch = '' ; + $cpucustom = '' ; + $cpufallback = '' ; if (!empty($domain['cpumode']) && $domain['cpumode'] == 'host-passthrough') { $cpumode .= "mode='host-passthrough'"; $cpucache = ""; @@ -406,8 +426,17 @@ if (!empty($domain['cpumigrate'])) $cpumigrate = " migratable='".$domain['cpumigrate']."'" ; } + # + #Skylake-Client-noTSX-IBRS + if (!empty($domain['cpumode']) && $domain['cpumode'] == 'custom') { + if (!empty($domain['cpucustom']['match'])) $cpumatch = " match='".$domain['cpucustom']['match'].'"'; + if (!empty($domain['cpucustom']['check'])) $cpucheck = " check='".$domain['cpucustom']['check'].'"'; + if (!empty($domain['cpucustom']['fallback'])) $cpufallback = " fallback='".$domain['cpucustom']['fallback'].'"'; + if (!empty($domain['cpucustom']['model'])) $cpucustom = "".$domain['cpucustom']['model'].""; + } - $cpustr = " + $cpustr = " + $cpucustom $cpucache $cpufeatures @@ -2327,6 +2356,40 @@ return $var; } + # + # Skylake-Client-noTSX-IBRS + + function domain_get_cpu_custom($domain) { + $tmp = $this->get_xpath($domain, '//domain/cpu/@match', false); + if (!$tmp) + $tmp[0] = ''; + + $var['match'] = trim($tmp[0]); + unset($tmp); + + $tmp = $this->get_xpath($domain, '//domain/cpu/@check', false); + if (!$tmp) + $tmp[0] = ''; + + $var['check'] = trim($tmp[0]); + unset($tmp); + + $tmp = $this->get_xpath($domain, '//domain/cpu/model/@fallback', false); + if (!$tmp) + $tmp[0] = ''; + + $var['fallback'] = trim($tmp[0]); + unset($tmp); + + $tmp = $this->get_xpath($domain, '//domain/cpu/model', false); + if (!$tmp) + $tmp[0] = ''; + + $var['model'] = trim($tmp[0]); + unset($tmp); + + return $var; + } function domain_get_cpu_migrate($domain) { $tmp = $this->get_xpath($domain, '//domain/cpu/@migratable', false); diff --git a/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php b/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php index 01475f37f..819e021b3 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php +++ b/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php @@ -712,47 +712,47 @@ private static $encoding = 'UTF-8'; $arrDisplayOptions = [ "H1.16M" => [ - "text" => "1 Screen 16Mb Memory", + "text" => "1 Display 16Mb Memory", "qxlxml" => "ram='65536' vram='16384' vgamem='16384' heads='1' primary='yes'", ], "H1.32M" => [ - "text" => "1 Screen 32Mb Memory", + "text" => "1 Display 32Mb Memory", "qxlxml" => "ram='65536' vram='32768' vgamem='32768' heads='1' primary='yes'", ], "H1.64M" => [ - "text" => "1 Screen 64Mb Memory", + "text" => "1 Display 64Mb Memory", "qxlxml" => "ram='65536' vram='65536' vram64='65535' vgamem='65536' heads='1' primary='yes'", ], "H1.128M" => [ - "text" => "1 Screen 128Mb Memory", + "text" => "1 Display 128Mb Memory", "qxlxml"=> "ram='65536' vram='131072' vram64='131072' vgamem='65536' heads='1' primary='yes'", ], "H1.256M" => [ - "text" => "1 Screen 256Mb Memory", + "text" => "1 Display 256Mb Memory", "qxlxml" => "ram='65536' vram='262144' vram64='262144' vgamem='65536' heads='1' primary='yes'", ], "H2.64M" => [ - "text" => "2 Screens 64Mb Memory", + "text" => "2 Displays 64Mb Memory", "qxlxml" => "ram='65536' vram='65536' vram64='65535' vgamem='65536' heads='2' primary='yes'", ], "H2.128M" => [ - "text" => "2 Screens 128Mb Memory", + "text" => "2 Displays 128Mb Memory", "qxlxml" => "ram='65536' vram='131072'vram64='131072' vgamem='65536' heads='2' primary='yes'", ], "H2.256M" => [ - "text" => "2 Screens 256Mb Memory", + "text" => "2 Displays 256Mb Memory", "qxlxml" => "ram='65536' vram='262144'vram64='262144' vgamem='65536' heads='2' primary='yes'", ], "H4.64M" => [ - "text" => "4 Screens 64Mb Memory", + "text" => "4 Displays 64Mb Memory", "qxlxml" => "ram='65536' vram='65536' vram64='65535' vgamem='65536' heads='4' primary='yes'", ], "H4.128M" => [ - "text" => "4 Screens 128Mb Memory", + "text" => "4 Displays 128Mb Memory", "qxlxml" => "ram='65536' vram='131072'vram64='131072' vgamem='65536' heads='4' primary='yes'", ], "H4.256M" => [ - "text" => "4 Screens 256Mb Memory", + "text" => "4 Displays 256Mb Memory", "qxlxml"=> "ram='65536' vram='262144' vram64='262144' vgamem='65536' heads='4' primary='yes'", ], ]; @@ -1453,6 +1453,7 @@ private static $encoding = 'UTF-8'; 'maxmem' => $lv->domain_get_memory($res), 'password' => '', //TODO? 'cpumode' => $lv->domain_get_cpu_type($res), + 'cpucustom' => $lv->domain_get_cpu_custom($res), 'cpumigrate' => $lv->domain_get_cpu_migrate($res), 'vcpus' => $dom['nrVirtCpu'], 'vcpu' => $lv->domain_get_vcpu_pins($res), diff --git a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php index 61bcbaeb9..63755ce27 100644 --- a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php +++ b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php @@ -464,11 +464,11 @@ _(CPU)_ _(Mode)_: - >_(Migratable)_: + >_(Migratable)_: - hidden class="narrow" title="_(define if migratable)_"> + + + + + + +
_(CPU Custom)_ _(Model)_: + get_domain_capabilities(null,"x86_64",null,null,null))->xpath("//domainCapabilities/cpu/mode[@name='custom']") ; + $arrValidCustomTypes = json_decode(json_encode($new[0]), true)['model']; ?> + + >_(Match)_: + + >_(Check)_: + + >_(Fallback)_: + +
@@ -2432,11 +2476,14 @@ $(function() { if (myvalue == "custom") { document.getElementById("domain_cpumigrate_text").style.visibility="hidden"; document.getElementById("domain_cpumigrate").style.visibility="hidden"; + document.getElementById("domain_cpucustom").style.display="inline"; + document.getElementById("domain_cpucustom").style.visibility="visible"; } else { document.getElementById("domain_cpumigrate_text").style.display="inline"; document.getElementById("domain_cpumigrate_text").style.visibility="visible"; document.getElementById("domain_cpumigrate").style.display="inline"; document.getElementById("domain_cpumigrate").style.visibility="visible"; + document.getElementById("domain_cpucustom").style.visibility="hidden"; } }) ;