mirror of
https://github.com/unraid/webgui.git
synced 2026-01-08 02:29:51 -06:00
Add QEMU arg Support
This commit is contained in:
@@ -984,6 +984,12 @@
|
||||
|
||||
}
|
||||
|
||||
function appendqemucmdline($xml,$cmdline) {
|
||||
$newxml = $xml ;
|
||||
if ($cmdline != null) $newxml = str_replace("</domain>",$cmdline."\n</domain>",$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,'<qemu:commandline>')) {
|
||||
$tmp = explode("\n", $xml);
|
||||
for ($i = 0; $i < sizeof($tmp); $i++)
|
||||
if (strpos('.'.$tmp[$i], "<domain type='kvm'"))
|
||||
if (strpos('.'.$tmp[$i], "<domain type='kvm'") || strpos('.'.$tmp[$i], '<domain type="kvm"'))
|
||||
$tmp[$i] = "<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>";
|
||||
$xml = join("\n", $tmp);
|
||||
}
|
||||
|
||||
@@ -1300,7 +1300,9 @@ private static $encoding = 'UTF-8';
|
||||
'pci' => $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,"<qemu:commandline>", 0) ;
|
||||
if ($x === false) return null ;
|
||||
$y = strpos($xml,"</qemu:commandline>", 0) ;
|
||||
$z=$y ;
|
||||
while ($y!=false) {
|
||||
$y = strpos($xml,"<qemu:commandline>", $z +19) ;
|
||||
if ($y != false) $z =$y ;
|
||||
}
|
||||
return substr($xml,$x, ($z + 19) -$x) ;
|
||||
}
|
||||
|
||||
function getchannels($res) {
|
||||
global $lv ;
|
||||
|
||||
Reference in New Issue
Block a user