diff --git a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php index cebfe945f..c28486269 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php +++ b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php @@ -369,6 +369,7 @@ $cpumode = ''; $cpucache = ''; $cpufeatures = ''; + $cpumigrate = ''; if (!empty($domain['cpumode']) && $domain['cpumode'] == 'host-passthrough') { $cpumode .= "mode='host-passthrough'"; $cpucache = ""; @@ -389,9 +390,11 @@ $intCores = $vcpus / $intCPUThreadsPerCore; $intThreads = $intCPUThreadsPerCore; } + + if (!empty($domain['cpumigrate'])) $cpumigrate = " migratable='".$domain['cpumigrate']."'" ; } - $cpustr = " + $cpustr = " $cpucache $cpufeatures @@ -2096,6 +2099,17 @@ return $var; } + function domain_get_cpu_migrate($domain) { + $tmp = $this->get_xpath($domain, '//domain/cpu/@migratable', false); + if (!$tmp) + return 'no'; + + $var = $tmp[0]; + unset($tmp); + + return $var; + } + function domain_get_vcpu($domain) { $tmp = $this->get_xpath($domain, '//domain/vcpu', false); $var = $tmp[0]; diff --git a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php index 939d352ed..f09ef6f65 100644 --- a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php +++ b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php @@ -53,6 +53,7 @@ 'maxmem' => 1024 * 1024, 'password' => '', 'cpumode' => 'host-passthrough', + 'cpumigrate' => 'on', 'vcpus' => 1, 'vcpu' => [0], 'hyperv' => 1, @@ -312,13 +313,26 @@ + + - +
_(CPU Mode)_:_(CPU)_ _(Mode)_: - _('Host Passthrough').' (' . $strCPUModel . ')', 'custom' => _('Emulated').' ('._('QEMU64').')'], $arrConfig['domain']['cpumode']);?> + >_(Migratable)_: + +
@@ -380,10 +394,8 @@ } ?> - - - _(Max)_ _(Memory)_: - + + _(Max)_ _(Memory)_: -
@@ -1833,6 +1844,23 @@ $(function() { } }); + $("#vmform").on("change", ".cpu", function changeCPUEvent() { + var myvalue = $(this).val(); + var mylabel = $(this).children('option:selected').text(); + var cpumigrate = document.getElementById("domain_cpumigrate_text") ; + var cpumigrate_text = document.getElementById("domain_cpumigrate") ; + if (myvalue == "custom") { + document.getElementById("domain_cpumigrate_text").style.visibility="hidden"; + document.getElementById("domain_cpumigrate").style.visibility="hidden"; + } 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"; + } + + }) ; + $("#vmform").on("change", ".gpu", function changeGPUEvent() { var myvalue = $(this).val(); var mylabel = $(this).children('option:selected').text();