diff --git a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php index ec996fc28..1c93a863d 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php +++ b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php @@ -281,6 +281,7 @@ $pciboot = $config['pciboot']; $audios = $config['audio']; $template = $config['template']; + $clocks = $config['clock']; $type = $domain['type']; $name = $domain['name']; @@ -442,6 +443,7 @@ break; } + /* if ($os_type == "windows") $hypervclock = "" ; else $hypervclock = "" ; $clock = " @@ -465,6 +467,42 @@ "; } + */ + + $clock = "" ; + foreach ($clocks as $clockname => $clockvalues) { + switch ($clockname){ + case "rtc": + if ($clockvalues['present'] == "yes") $clock .= ""; + break ; + case "pit": + if ($clockvalues['present'] == "yes") $clock .= ""; + break ; + case "hpet": + $clock .= "" ; + break ; + case "hypervclock": + $clock .= "" ; + break ; + } + } + $hyperv = "" ; + if ($domain['hyperv'] == 1 && $os_type == "windows") { + $hyperv = " + + + + + "; + + if ($clocks['hypervclock']['present'] == "yes") + $hyperv .= "" ; + $hyperv .=""; + #$clock = " + # + # "; + } + $clock .= "" ; $usbstr = ''; if (!empty($usb)) { diff --git a/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php b/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php index ef047fb22..1c6a33402 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php +++ b/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php @@ -650,6 +650,64 @@ private static $encoding = 'UTF-8'; ] ];} + $arrDefaultClocks = [ + "windows" => [ + "hpet" => [ + "present" => "no", + "tickpolicy" => "delay" + ], + "hypervclock" => [ + "present" => "yes", + "tickpolicy" => "delay" + ], + "pit" => [ + "present" => "yes", + "tickpolicy" => "delay" + ], + "rtc" => [ + "present" => "yes", + "tickpolicy" => "catchup" + ] + ], + "hyperv" => [ + "hpet" => [ + "present" => "no", + "tickpolicy" => "delay" + ], + "hypervclock" => [ + "present" => "yes", + "tickpolicy" => "delay" + ], + "pit" => [ + "present" => "no", + "tickpolicy" => "delay" + ], + "rtc" => [ + "present" => "no", + "tickpolicy" => "catchup" + ] + ] , + "other" => [ + "hpet" => [ + "present" => "no", + "tickpolicy" => "delay" + ], + "hypervclock" => [ + "present" => "no", + "tickpolicy" => "delay" + ], + "pit" => [ + "present" => "yes", + "tickpolicy" => "delay" + ], + "rtc" => [ + "present" => "yes", + "tickpolicy" => "catchup" + ] + ] + ] ; + + // Read configuration file (guaranteed to exist) $domain_cfgfile = "/boot/config/domain.cfg"; $domain_cfg = parse_ini_file($domain_cfgfile); @@ -1351,7 +1409,7 @@ private static $encoding = 'UTF-8'; foreach ($old['devices']['disk'] as $k => $d) if ($source==$d['source']['@attributes']['file']) $new['devices']['disk'][$key]['driver']['@attributes'] = $d['driver']['@attributes']; } // settings not in the GUI, but maybe customized - unset($new['clock']); + unset($old['clock']); // preserve vnc/spice port settings // unset($new['devices']['graphics']['@attributes']['port'],$new['devices']['graphics']['@attributes']['autoport']); if (!$new['devices']['graphics']) unset($old['devices']['graphics']); @@ -1454,7 +1512,6 @@ private static $encoding = 'UTF-8'; $clocks = new SimpleXMLElement($xml); $clocks = json_decode(json_encode($clocks->clock),true) ; $arrClocks = [ - "offset" => $clocks['@attributes']['offset'] , "hpet" => [ "present" => "no", "tickpolicy" => "delay" @@ -1477,7 +1534,7 @@ private static $encoding = 'UTF-8'; $tickpolicy = $timer["@attributes"]["tickpolicy"] ; $present = $timer["@attributes"]["present"] ; if (isset($present)) $arrClocks[$name]['present'] = $present ; - if (isset($tickpolicy)) $arrClocks[$name]['tickpolicy'] = $tickpolicy ; + if (isset($tickpolicy)) { $arrClocks[$name]['tickpolicy'] = $tickpolicy ; $arrClocks[$name]['present'] = 'yes' ; } } return json_encode($arrClocks) ; } diff --git a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php index 8b8129422..d0f3138b4 100644 --- a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php +++ b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php @@ -275,6 +275,11 @@ $arrConfig['template']['os'] = ($arrConfig['domain']['clock']=='localtime' ? 'windows' : 'linux'); } $os_type = ((empty($arrConfig['template']['os']) || stripos($arrConfig['template']['os'], 'windows') === false) ? 'other' : 'windows'); + if (isset($arrConfig['clocks'])) $arrClocks = json_decode($arrConfig['clocks'],true) ; else { + if ($os_type == "windows") { + if ($arrConfig['domain']['hyperv'] == 1) $arrClocks = $arrDefaultClocks['hyperv'] ; else $arrClocks = $arrDefaultClocks['windows'] ; + } else $arrClocks = $arrDefaultClocks['other'] ; + } ?> @@ -288,11 +293,9 @@ - - @@ -1356,7 +1359,7 @@
+ ()
Use boot order to set device as bootable and boot sequence. Only NVMe and Network devices (PCI types 0108 and 02xx) supported for boot order.

-
- - - - - -
_(QEMU Command Line)_: -
-
-

If you need to add QEMU arguments to the XML

- Examples can be found on the Libvirt page => https://libvirt.org/kbase/qemu-passthrough-security.html -

-
+ @@ -1454,6 +1445,78 @@

Click Create to generate the vDisks and return to the Virtual Machines page where your new VM will be created.

+ +
+ + + + + + + + +
_(Advanced tuning options)_
_(QEMU Command Line)_: +
+
+

If you need to add QEMU arguments to the XML

+ Examples can be found on the Libvirt page => https://libvirt.org/kbase/qemu-passthrough-security.html +

+
+ + + + + + + $arrTimer) { + if ($i =="offset") continue ; + if ($clockcount == 0) $clocksourcetext = _("Clocks Source").":" ;else $clocksourcetext = "" ; + ?> + + + + + +
_(Clocks)_
_(Clocks Offset)_: + + +
+ + _(Present)_: + + _(Tickpolicy)_: + +
+
+

Allows setting of timers and offset into the XML

+ Details can be found on the Libvirt XML page => https://libvirt.org/formatdomain.html#id25 +

+
@@ -1526,6 +1589,15 @@ function BIOSChange(bios) { } } +function QEMUChgCmd(qemu) { + var value = qemu.value; + if (value != "") { + document.getElementById("qemucmdline").setAttribute("rows","15"); + } else { + document.getElementById("qemucmdline").setAttribute("rows","2"); + } +} + function SetBootorderfields(usbbootvalue) { var bootelements = document.getElementsByClassName("bootorder"); for(var i = 0; i < bootelements.length; i++) { @@ -2043,6 +2115,7 @@ $(function() { }); } else { $('#vmform #domain_clock').val('utc'); + $('#vmform #clockoffset').val('utc'); $("#vmform #domain_machine option").each(function(){ if ($(this).val().indexOf('q35') != -1) { $('#vmform #domain_machine').val($(this).val()).change();