diff --git a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php index c6379c458..f66fb2843 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/libvirt.php +++ b/emhttp/plugins/dynamix.vm.manager/include/libvirt.php @@ -984,6 +984,12 @@ } + function appendqemucmdline($xml,$cmdline) { + $newxml = $xml ; + if ($cmdline != null) $newxml = str_replace("",$cmdline."\n",$xml) ; + return $newxml ; + } + function domain_new($config) { // attempt to create all disk images if needed @@ -1007,6 +1013,8 @@ // generate xml for this domain $strXML = $this->config_to_xml($config); + $qemucmdline = $config['qemucmdline']; + $strXML = $this->appendqemucmdline($strXML,$qemucmdline) ; // Start the VM now if requested @@ -1698,7 +1706,7 @@ if (strpos($xml,'')) { $tmp = explode("\n", $xml); for ($i = 0; $i < sizeof($tmp); $i++) - if (strpos('.'.$tmp[$i], " $arrOtherDevices, 'nic' => $arrNICs, 'usb' => $arrUSBDevs, - 'shares' => $lv->domain_get_mount_filesystems($res) + 'shares' => $lv->domain_get_mount_filesystems($res), + 'qemucmdline' => getQEMUCmdLine($strDOMXML), + 'clocks' => getClocks($strDOMXML) ]; } @@ -1447,6 +1449,23 @@ private static $encoding = 'UTF-8'; $memorybacking = $memoryBacking->memoryBacking ; return json_encode($memorybacking); ; } + function getClocks($xml) { + $clocks = new SimpleXMLElement($xml); + $clocks = $clocks->clock ; + return json_encode($clocks); ; + } + + function getQEMUCmdLine($xml) { + $x = strpos($xml,"", 0) ; + if ($x === false) return null ; + $y = strpos($xml,"", 0) ; + $z=$y ; + while ($y!=false) { + $y = strpos($xml,"", $z +19) ; + if ($y != false) $z =$y ; + } + return substr($xml,$x, ($z + 19) -$x) ; + } function getchannels($res) { global $lv ;